summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhc <hc@email.ch>2024-09-18 09:54:37 +0100
committerhc <hc@email.ch>2024-09-18 09:54:37 +0100
commit0793e6810f073a7eaa5f63112d0d90c88d5c72e0 (patch)
tree285a4c91a76553dde7e93ebf12bb34a0d8ea9cf8
parent5226ac1fd10d06c21f349b2f157bfdb6a93ba377 (diff)
auto install script
-rwxr-xr-xadd-ssh-keys.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/add-ssh-keys.sh b/add-ssh-keys.sh
new file mode 100755
index 0000000..a188244
--- /dev/null
+++ b/add-ssh-keys.sh
@@ -0,0 +1,22 @@
1#!/bin/bash
2
3script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
4
5cd "$script_dir" || exit 1
6
7mkdir -p ~/.ssh
8
9touch ~/.ssh/authorized_keys
10
11for pubkey in *.pub; do
12 if [[ -f "$pubkey" ]]; then
13 cat "$pubkey" >> ~/.ssh/authorized_keys
14 echo "Added $pubkey to authorized_keys"
15 fi
16done
17
18chmod 600 ~/.ssh/authorized_keys
19
20 # removes duplicates
21#sort -u ~/.ssh/authorized_keys -o ~/.ssh/authorized_keys
22