From 0793e6810f073a7eaa5f63112d0d90c88d5c72e0 Mon Sep 17 00:00:00 2001 From: hc Date: Wed, 18 Sep 2024 09:54:37 +0100 Subject: auto install script --- add-ssh-keys.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 add-ssh-keys.sh (limited to 'add-ssh-keys.sh') diff --git a/add-ssh-keys.sh b/add-ssh-keys.sh new file mode 100755 index 0000000..a188244 --- /dev/null +++ b/add-ssh-keys.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" + +cd "$script_dir" || exit 1 + +mkdir -p ~/.ssh + +touch ~/.ssh/authorized_keys + +for pubkey in *.pub; do + if [[ -f "$pubkey" ]]; then + cat "$pubkey" >> ~/.ssh/authorized_keys + echo "Added $pubkey to authorized_keys" + fi +done + +chmod 600 ~/.ssh/authorized_keys + + # removes duplicates +#sort -u ~/.ssh/authorized_keys -o ~/.ssh/authorized_keys + -- cgit v1.2.3-70-g09d2