Ssh without password: Difference between revisions

From HPCwiki
Jump to navigation Jump to search
No edit summary
Line 52: Line 52:
== Configuring ssh without password using PuTTY ==
== Configuring ssh without password using PuTTY ==
< will need a Windows user to volunteer to add some text here >
< will need a Windows user to volunteer to add some text here >
== See also ==
* [[B4F_cluster | B4F Cluster]]
== External Links ==

Revision as of 21:05, 24 November 2013

Secure shell (ssh) protocols can be configure to work without protocols. This is particularly helpful for machines that are used often.

Configuring ssh without password from a POSIX-compliant terminal

Step 1: create a public key and copy to remote computer

  • Log into a local Linux or MacOSX computer
  • Type the following to generate the ssh key:

<source lang='bash'> ssh-keygen -t dsa </source>

  • Accept the default key location by pressing Enter.
  • Secure permission of your authentication keys by closing permission to your home directory, .ssh directory, and authentication files

<source lang='bash'> chmod go-w $HOME chmod 700 $HOME/.ssh chmod go-rwx $HOME/.ssh/* </source>

  • Type the following to copy the key to the remote server (this will prompt for a password).

<source lang='bash'> cd ~/.ssh scp id_dsa.pub remote_username@remote_host:/tmp </source>

  • Type the following to add the ssh key to the remote user's authorization keys (this will prompt for a password).

ssh remote_username@remote_host 'cat /tmp/id_dsa.pub >>/home/

Step 2: configure the public key from the local computer on the remote computer

  • log in to the remote computer using ssh (this will prompt for a password)

<source lang='bash'> ssh remote_username@remote_host </source>

  • copy the public key generated on the local computer, that was copied to /tmp on the remote computer, is now appended to .ssh/authorized_keys2. Note that a file called .ssh/authorized_keys may already be present.

<source lang='bash'> cat /tmp/id_dsa.pub >>$HOME/.ssh/authorized_keys2 </source>

  • similar to your local computer, make sure the permission on your remote home folder, .ssh folder, and authentication files are properly set (NOTE: this may already be the case).

<source lang='bash'> chmod go-w $HOME chmod 700 $HOME/.ssh chmod go-rwx $HOME/.ssh/* </source>

  • Lastly, remove the public key from the temporary folder.

<source lang='bash'> rm /tmp/id_dsa.pub </source>

  • If you log out of the remote computer and back in again, from the local computer from which you copied the public key, you will notice you will no longer be prompted for a password.

Configuring ssh without password for the B4F Cluster

  • Create a public key as in Step 1 of the previous section and copy it to the B4F Cluster. Note that a public/private key pair needs to be made only once per machine.
  • Similar to step 2 of the previous section, add the public key to the $HOME/.ssh/authorized_keys2 file. There is already a $HOME/.ssh/authorized_keys present. You may append the key to this file as an alternative, but take care not to remove content that is already there. The cluster is configured so that passwordless communication will all other nodes is default.

Configuring ssh without password using PuTTY

< will need a Windows user to volunteer to add some text here >

See also

External Links