From 46acb32c654f3f2711a7c6f80d4bd0bac595e0b9 Mon Sep 17 00:00:00 2001 From: akanealw Date: Wed, 13 Mar 2024 11:30:02 -0500 Subject: [PATCH] add section for adding ssh keys for akanealw --- alpine/alpine-essentials.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/alpine/alpine-essentials.sh b/alpine/alpine-essentials.sh index 3d98d5b..6282150 100755 --- a/alpine/alpine-essentials.sh +++ b/alpine/alpine-essentials.sh @@ -40,3 +40,21 @@ rm /etc/motd > /dev/null 2>&1 # enable and start sshd rc-update add sshd rc-service sshd start + +# add ssh keys for akanealw +if [[ -d /home/akanealw ]]; then + cp /home/akanealw/.ssh/authorized_keys /home/akanealw/.ssh/authorized_keys.bak > /dev/null 2>&1 + isInFile=$(cat /home/akanealw/.ssh/authorized_keys | grep -c "winpc-akanealw") + if [ $isInFile -eq 0 ]; then + echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBKYj+eRQsvdLvrJNoqugb9A7iQT+BEPb6LI9BseyhWR winpc-akanealw" >> /home/akanealw/.ssh/authorized_keys + chown akanealw:akanealw /home/akanealw/.ssh/* + chmod 600 /home/akanealw/.ssh/* + fi + + isInFile=$(cat /home/akanealw/.ssh/authorized_keys | grep -c "server-akanealw") + if [ $isInFile -eq 0 ]; then + echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGAiw0sQxxTg/zBm/Hz4LLjtiuGfefF2vogGkYcWox4S server-akanealw" >> /home/akanealw/.ssh/authorized_keys + chown akanealw:akanealw /home/akanealw/.ssh/* + chmod 600 /home/akanealw/.ssh/* + fi +fi