By default we need type remote user’s password to access to remote host with ssh command.This tutorial shows how to configure to access remote host without password.


local host:
remote host:,username:username
we want to access to username@ from without password using ssh

1.Open terminal in machine and type:


just press Enter to finish this command and it will create plublic/private rsa key pair:id_rsa,

2.Create .ssh directory in remote host which we want to access to.For security,change the permission to 700.
use ssh to access to remote host:

ssh -l username

create .ssh directory and change it’s permission:

mkdir .ssh
chmod 700 .ssh

3.copy and paste file from localhost to remote host’s .ssh folder and rename to authorized_keys

scp .ssh/ username@

Now,use ssh command to access to username@ from and it won’t ask for password again.
In addition,if it outputs:Agent admitted failure to sign using the key.Try ps -Af|agent to make sure ssh-agent has started.If not,start it and add id_rsa :

ssh-add id_rsa