Ssh without password: Difference between revisions

From HPCwiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 33: Line 33:
cat /tmp/id_dsa.pub >>$HOME/.ssh/authorized_keys2
cat /tmp/id_dsa.pub >>$HOME/.ssh/authorized_keys2
</source>
</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'>
* 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'>
<source lang='bash'>
chmod go-w $HOME
chmod go-w $HOME

Revision as of 21:09, 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:
ssh-keygen -t dsa
  • 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
chmod go-w $HOME
chmod 700 $HOME/.ssh
chmod go-rwx $HOME/.ssh/*
  • Type the following to copy the key to the remote server (this will prompt for a password).
cd ~/.ssh
scp id_dsa.pub remote_username@remote_host:/tmp
  • 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)
ssh remote_username@remote_host
  • copy the public key generated on the local computer, that was copied to /tmp on the remote computer, is now appended to .ssh/authorized_keys.
cat /tmp/id_dsa.pub >>$HOME/.ssh/authorized_keys2
  • 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).
chmod go-w $HOME
chmod 700 $HOME/.ssh
chmod go-rwx $HOME/.ssh/*