wiki:PasswordlessSsh

Version 2 (modified by trac, 12 years ago) ( diff )

Passwordless SSH

Passwordless SSH is useful when you want to copy (scp) a large number of files from one system to another, e.g. when moving files from the compute cluster's scratch space to a local machine.

In particular, if you find that your scp jobs frequently stall, you can utilize a script to account for this when passwordless SSH is enabled.


Setting up passwordless SSH requires the generation and copying of a machine-specific key from the place where you're copying files from (the client) to the place you're copying files to (the server). This key must then be appended to a file on the server. This is accomplished as follows:

  1. On the computer you'll be copying files from (the client), go to ~/.ssh and type the following. Follow all default prompts.
    ssh-keygen -t dsa
    
    This will generate two files, by default called id_dsa and id_dsa.pub.
  2. Change the permissions of the generated .pub file to 600 be read/writeable only by you and not readable by anoyone else, with
    chmod 600 id_dsa.pub
    
  3. Copy this file to the server, giving it a specific name in the process. For example, if your username is sunTzu, the client name is yin, and the target is yang, do
    scp id_dsa.pub sunTzu@yang.machine:~/.ssh/yin.pub
    
  4. SSH to the server, and
    cd ~/.ssh
    
  5. Append (or create) the file with this public key with
    cat yin.pub >> authorized_keys
    
  6. You should now be able to SSH from the client to the server without typing your password.


To enable passwordless SSH in the other direction, perform the analogous actions. As a precaution, you should probably delete the yin.pub file on the server.

Note: See TracWiki for help on using the wiki.