Skip to content

Instantly share code, notes, and snippets.

@cristianp6
Last active October 26, 2016 08:41
Show Gist options
  • Save cristianp6/f8a5c4d929446fec6ea7 to your computer and use it in GitHub Desktop.
Save cristianp6/f8a5c4d929446fec6ea7 to your computer and use it in GitHub Desktop.
SSH Passwordless auto login to remote host

Create authentication SSH-Kegen key on local/client host

cd ~ && ssh-keygen -t rsa

You could skip passphrase.

From host1, create .ssh directory on remote host via ssh

ssh USER@REMOTE_HOST -p 22 mkdir -p ~/.ssh

Upload generated public keys to remote host

cat ~/.ssh/id_rsa.pub | ssh USER@REMOTE_HOST -p 22 'cat >> ~/.ssh/authorized_keys'

Set permissions on remote host

ssh USER@REMOTE_HOST -p 22 "chmod 700 ~/.ssh; chmod 640 ~/.ssh/authorized_keys"

Now login should work without password, try:

ssh USER@REMOTE_HOST -p 22
@ulfrenman
Copy link

Try this on your local host and your done!

ssh-copy-id REMOTE_HOST

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment