diff options
author | sanine <sanine.not@pm.me> | 2023-06-23 21:54:55 -0500 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2023-06-23 21:54:55 -0500 |
commit | 81a994a8b23c2d41a10e1cc9c0cee2797efe4693 (patch) | |
tree | 7912755a8186898d77967c25d2bd8f310f28945e |
add ssh/update-keys.sh
-rw-r--r-- | ssh/update-keys.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/ssh/update-keys.sh b/ssh/update-keys.sh new file mode 100644 index 0000000..5a56392 --- /dev/null +++ b/ssh/update-keys.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +SSH_DIR="$HOME/.ssh" + +KEYS_DIR="$SSH_DIR/authorized_keys.d" +KEYS_FILE="SSH_DIR/authorized_keys" + +if [ ! -d "$KEYS_DIR" ]; then + echo "creating $KEYS_DIR/" + mkdir "$KEYS_DIR" +fi + +if [ -e "$KEYS_FILE" ]; then + mv "$KEYS_FILE" "$KEYS_FILE.bak" +fi + +for file in "$KEYS_DIR/*.pub"; do + cat "$file" >> "$KEYS_FILE" +done |