summaryrefslogtreecommitdiff
path: root/ssh/update-keys.sh
diff options
context:
space:
mode:
Diffstat (limited to 'ssh/update-keys.sh')
-rw-r--r--ssh/update-keys.sh19
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