Skip to content

Instantly share code, notes, and snippets.

@maxclaus
Created January 16, 2014 10:23
Show Gist options
  • Save maxclaus/8452679 to your computer and use it in GitHub Desktop.
Save maxclaus/8452679 to your computer and use it in GitHub Desktop.
Setting up SSH key authentication on Unix
# 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