Last active
December 16, 2015 13:28
-
-
Save dbonates/5441367 to your computer and use it in GitHub Desktop.
public keys for access without login prompt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#TODO: Adicionar o arquivo com o script local, que deve ser executado antes deste. | |
echo "remote ip:" | |
read TARGETIP | |
# generating keys | |
ssh-keygen -q -t rsa -f ~/.ssh/id_rsa -N "" | |
# sending to remote server (as root) | |
scp ~/.ssh/id_rsa.pub root@$TARGETIP: | |
# on remote server: | |
echo "Type the username which will login with this key:" | |
read USERNAME | |
mkdir .ssh | |
mv id_rsa.pub .ssh/authorized_keys | |
chown -R $USERNAME:$USERNAME .ssh | |
chmod 700 .ssh | |
chmod 600 .ssh/authorized_keys | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment