ssh to remote host without password

This post was written by admin on March 9, 2010
Posted Under: Internet

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.

First,assume:

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

1.Open terminal in 192.168.1.100 machine and type:

ssh-keygen

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 username@192.168.1.101:/home/username/.ssh/authorized_keys

Now,use ssh command to access to username@192.168.1.101 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

Related posts:

  1. Ssh to remote server without password in Ubuntu
  2. Enable remote desktop in Virtual machine(Virtualbox guest)
  3. Fix Mysql5.0 ERROR 1045(forget database password) in Ubuntu Linux
  4. Allow Remote Control to your desktop on ubuntu
  5. How to setup Boot password protection for Grub2 Entries

    Reader Comments

    Add a Comment

    required, use real name
    required, will not be published
    optional, your blog address