From 81a994a8b23c2d41a10e1cc9c0cee2797efe4693 Mon Sep 17 00:00:00 2001 From: sanine Date: Fri, 23 Jun 2023 21:54:55 -0500 Subject: add ssh/update-keys.sh --- ssh/update-keys.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 ssh/update-keys.sh (limited to 'ssh/update-keys.sh') 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 -- cgit v1.2.1