How to ssh without password?

If you have to ssh to a remote machine a number of times and you are too lazy too enter a password everytime, then this page will give you 5 simple steps for a password-less login.

On the host machine
Step 1: $ssh-keygen -t rsa

Step 2: Generating public/private rsa key pair.
            Enter file in which to save the key (/home/sandeep/.ssh/id_r     sa):
            You can specify a new location or let it just save in the default location by pressing enter.

Step 3: Enter passphrase (empty for no passphrase):
            Enter same passphrase again: 
            You can enter a passphrase that will be used for generation the key. A less secure way 
            would be to leave it blank.
            Your identification has been saved in /home/sandeep/.ssh/id_rsa.
            Your public key has been saved in /home/sandeep/.ssh/id_rsa.pub.
            The key fingerprint is:
            3f:3f:92:c0:49:98:fc:56:7e:7d:e0:92:4b:50:f6:b0 sandeep@sandeep-s11

Step 4: Copy the public key on the remote machine in the .ssh folder.
If a file authorized_keys file exists, you need to append contents of id_rsa to 
authorized_keys file.
Or if the file does not exist, rename id_rsa to authorized_keys using the following command.
$mv id_rsa authorized_keys

Step 5: Now ssh to the remote machine. And bingo !!! 

No comments:

Post a Comment