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.
we want to access to firstname.lastname@example.org from 192.168.1.100 without password using ssh
1.Open terminal in 192.168.1.100 machine and type:
just press Enter to finish this command and it will create plublic/private rsa key pair:id_rsa,id_rsa.pub
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 192.168.1.101 -l username
create .ssh directory and change it’s permission:
mkdir .ssh chmod 700 .ssh
3.copy and paste id_rsa.pub file from localhost to remote host’s .ssh folder and rename to authorized_keys
scp .ssh/id_rsa.pub email@example.com:/home/username/.ssh/authorized_keys
Now,use ssh command to access to firstname.lastname@example.org from 192.168.1.100 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-agent ssh-add id_rsa