Google+ Followers


Monday, April 16, 2012

Setup SSH without password, follow the steps below:-

To setup SSH without password, follow the steps below:-

  • First check if you have generated any DSA key in your client side .ssh folder
  • $ cd ~/.ssh
    $ ls -l
  • If you see any of the file name shown below, then you already have the key, you can skip the next steps (DSA key generation).
  • id_dsa
  • Enter the command below to generate the DSA key at the client side
  • $ ssh-keygen -t dsa
  • and you will see sth like below. just leave everything blank and press Enter all the way till it end.
  • Generating public/private dsa key pair.
    Enter file in which to save the key (/home/urname/.ssh/id_dsa):
    Created directory '/home/a/.ssh'.
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /home/urname/.ssh/id_dsa.
    Your public key has been saved in /home/urname/.ssh/
    The key fingerprint is:
    4e:3f:05:78:3f:9e:97:6c:3b:ad:e8:58:37:bd:35:d4 urname@yourmachine
  • Now transfer your DSA public key from client to the server using the command below:-
  • $ scp ~/.ssh/ remoteuser@remotemachine:.ssh/
  • Now, login to the remote machine and make sure the .ssh folder is at right permission
  • $ chmod 700 ~/.ssh
  • At the remote machine, append the to authorized_keys and remove the original key.
  • $ cat >> ~/.ssh/authorized_keys
    $ rm
  • Now change the permission of authorized_key file at the remote server
  • $ chmod 600 ~/.ssh/authorized_keys
  • Configuration done. you may now try to ssh to the remote server. It should not prompt you for any password from now on.

Notes to check if you still not able to ssh without password.

  • check if your remote .ssh folder has 700 permission.
  • If not use the command below:-
  • $ chmod 700 ~/.ssh
  • check if your remote .ssh/authorized_keys has 600 permission. If not then use the command below to change:-
  • $ chmod 600 ~/.ssh/authorized_keys

No comments:

Post a Comment