Login to LINUX / Unix box using SSH without password

Here is a mini HOWTO to SSH onto a UNIX Box without typing password.

Server: LINUXSERVER (user –> linuxuser)
Client: iMAC ( user –> demouser)

  • Generate Authentication keys using ssh-keygen on client
$ ssh-keygen -t rsa 
Generating public/private rsa key pair.
Enter file in which to save the key (/home/demouser/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/demouser/.ssh/id_rsa.
Your public key has been saved in /home/demouser/.ssh/id_rsa.pub.
The key fingerprint is:
xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx demouser@iMAC
The key’s randomart image is:
+–[ RSA 2048]—-+
  • Copy the id_rsa.pub to server onto $HOME_DIR/.ssh/authorized_keys2
  • Setup a symbolic link to authorized_keys
          ln -s authorized_keys2 authorized_keys
  • chmod 0600 on authorized_keys2 & authorized_keys file
  • From the client try ssh linuxuser@linuxserver, ssh shouldn’t ask for password. 

Leave a Reply

Your email address will not be published. Required fields are marked *