diff options
Diffstat (limited to 'add-ssh-keys.sh')
| -rwxr-xr-x | add-ssh-keys.sh | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/add-ssh-keys.sh b/add-ssh-keys.sh index a188244..b559e42 100755 --- a/add-ssh-keys.sh +++ b/add-ssh-keys.sh | |||
| @@ -1,22 +1,7 @@ | |||
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | 2 | ||
| 3 | script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" | 3 | cd "$( dirname "${BASH_SOURCE[0]}" )" || exit 1 |
| 4 | |||
| 5 | cd "$script_dir" || exit 1 | ||
| 6 | 4 | ||
| 7 | mkdir -p ~/.ssh | 5 | mkdir -p ~/.ssh |
| 8 | 6 | cat *.pub | sort -u > ~/.ssh/authorized_keys | |
| 9 | touch ~/.ssh/authorized_keys | ||
| 10 | |||
| 11 | for pubkey in *.pub; do | ||
| 12 | if [[ -f "$pubkey" ]]; then | ||
| 13 | cat "$pubkey" >> ~/.ssh/authorized_keys | ||
| 14 | echo "Added $pubkey to authorized_keys" | ||
| 15 | fi | ||
| 16 | done | ||
| 17 | |||
| 18 | chmod 600 ~/.ssh/authorized_keys | 7 | chmod 600 ~/.ssh/authorized_keys |
| 19 | |||
| 20 | # removes duplicates | ||
| 21 | #sort -u ~/.ssh/authorized_keys -o ~/.ssh/authorized_keys | ||
| 22 | |||
