Just another tech blog.

A blog abt GNU/Linux, programming, hacking, and my life.

Login in ssh without a password

Posted by ajay on June 1, 2006

Many of you guys have different accounts on different systems on linux .. and you might log on from one system to other system regularly . like me. But each time you login it asks for a password and some of you might not want this as you have to type the password each and every time and this is unnecessary effort . So here is a method you can use for login in ssh shells without a password .

Suppose you want to login from system A to system B on user X. Then you might try these commands .. But you need your password of user X at system B once .. if you have it then type the following commands on system A ..

[user@A]ssh-keygen -t rsa [enter]

RSA here is the type of encryption used .. you can have RSA as well as DSA on most standard unix systems.

it will give the following output

Generating public/private rsa key pair.

Enter file in which to save the key (/home/ajay/.ssh/id_rsa): [enter]

Enter passphrase (empty for no passphrase):[enter]

Enter same passphrase again:[enter]

Your identification has been saved in id_rsa.

our public key has been saved in id_rsa.pub.

The key fingerprint is:

ef:b8:fd:d8:de:63:d2:f0:ea:3b:ba:1b:ad:e9:b6:ce user@localhost.localdomain

[user@A]

dont worry about it now run the command

[user@A]scp ~/.ssh/id_rsa.pub X@B:.ssh/authorized_keys2 [enter]

X@B's password: ******* [enter]

give it the password ..

you are done .. now each time you login frm system A to system B using user X it wont ask you for password .. But be careful as someone else might login to ur private account on B once it gets access to A ..Nyways yeah it saves a lot of work specially for those who keep long and strong passwords for their accounts ..

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: