Created
January 16, 2014 10:23
-
-
Save maxclaus/8452679 to your computer and use it in GitHub Desktop.
Setting up SSH key authentication on Unix
This file contains hidden or 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
# generate ssh key | |
ssh-keygen -t dsa | |
# (Don’t enter a passphrase unless you want to type it every time you want to use the key) | |
# set permissions | |
chmod 700 ~/.ssh | |
chmod 600 ~/.ssh/id_dsa | |
chmod 644 ~/.ssh/id_dsa.pub | |
# if exist | |
cat ~/.ssh/id_rsa.pub | ssh YOUR_USER@SERVER_IP "cat - >> ~/.ssh/authorized_keys" | |
# if do not exist | |
scp ~/.ssh/id_rsa.pub YOUR_USER@SERVER_IP:~/.ssh/authorized_keys | |
# maybe need connect to server and set right permissions to authorized_keys | |
# chmod 0600 ~/.ssh/authorized_keys | |
# try connect to server | |
ssh YOUR_USER@SERVER_IP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment