summaryrefslogtreecommitdiff
path: root/ssh/update-keys.sh
blob: 28e5e75833f28f5bd4abe1b78bf7c41f33375179 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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