SSH login without password

You want to use Linux and OpenSSH to automize your tasks. Therefore you need an automatic login from host A / user tarique to Host B / user tarique. You don’t want to enter any passwords, because you want to call ssh from a within a shell script.

Follow the steps below

    [tarique@A]$ ssh-keygen -t rsa

Now use ssh to create a directory ~/.ssh as user tarique on B

    [tarique@A]$ scp .ssh/id_rsa.pub tarique@B:
    [tarique@A]$ ssh tarique@B

Finally append tariques’s@A new public key to tarique@B:.ssh/authorized_keys and enter password one last time:

    [oracle@B]$cat id_rsa.pub >>.ssh/authorized_keys

 N.B Please ensure that you have ssh installed on your system :-)
 If .ssh and its parent directory is group writable then this will not work
 Sometimes it cause a little delay to get the password prompt and it actually
 happen by the following 2 lines at /etc/ssh/ssh_config
  # GSSAPIAuthentication yes
  # GSSAPIDelegateCredentials no
 Just comment out these 2 line and thats it!!!you will do a faster login
 
 If you want to debug what actually happen during ssh session then just type
       ssh user@host -v 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: