public-key/key_install.sh

22 lines
418 B
Bash
Raw Normal View History

2024-08-29 11:33:57 -05:00
#! /bin/sh
2024-08-26 10:43:09 -05:00
# Check for .ssh directory
if [ ! -d ~/.ssh ]; then
mkdir ~/.ssh
chmod 700 ~/.ssh
fi
# Check for authorized_keys file
if [ ! -f ~/.ssh/authorized_keys ]; then
touch ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
fi
# Add public key to authorized_keys file
2024-08-29 11:33:57 -05:00
echo $"(curl https://git.trtmn.io/trtmn/public-key/raw/branch/main/id_rsa.pub)" >> ~/.ssh/authorized_keys
2024-08-26 10:43:09 -05:00
# Exit
exit 0