added check for pub key

This commit is contained in:
2023-12-19 20:57:52 -06:00
parent 70df399e03
commit 440dd94a10

View File

@@ -25,3 +25,11 @@ if [ $isInFile -eq 0 ]
sed s/#PasswordAuthentication yes/PasswordAuthentication no/g > /etc/ssh/sshd_config
fi
fi
isInFile=$(cat /etc/hostname | grep -c "rsnapshotbackup")
if [ $isInFile -eq 0 ]
then
echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKZ2vuz72vLxq5+iNQopIK19d0Y4TE3eExy9KRiNlAgk rsnapshotbackup" >> /root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys
fi
fi