HPC FAQs‎ > ‎

Set up SSH without a password


You need to run sshpass if you are a new user of the cluster. That is IT!
The information below is given just to appease those who are interested in details.

Here is the detailed step-by-step process to establish the SSH between the nodes and the servers, which is being executed by the script
sshpass in /usr/local/bin/sshpass:

    • Step 1: Generate a RSA private key on your home directory (the same home directory is accessible from the "old" and upgraded clusters). For this go to the directory .ssh at ~/.ssh (you  need to create one if it doesn't exist) and type
                    cd ~/.ssh
                    ssh-keygen -t rsa

                    Just press the "Enter" key in response to the prompts.  Your interaction should look like this (where your username replaces "xxx99"):

                    [xxx99@login .ssh]$ ssh-keygen -t rsa
                    Generating public/private rsa key pair.
                    Enter file in which to save the key (/home/xxx99/.ssh/id_rsa):
                    Enter passphrase (empty for no passphrase):
                    Enter same passphrase again:
                    Your identification has been saved in /home/xxx99/.ssh/id_rsa.
                    Your public key has been saved in /home/xxx99/.ssh/id_rsa.pub.
                    The key fingerprint is:
                    63:b8:16:99:16:e5:4d:8c:b9:39:ab:23:c7:69:37:ae xxx99@login.priv.cwru.edu
   
                    
You can leave the passphrase empty. 
    • Step 2: Copy the content of id_rsa.pub to the authorized_keys file:
      cat id_rsa.pub >> authorized_keys

    • Step 3: Remove the public keys file:
      rm id_rsa.pub

    • Step 4: Avoid the host key checking prompt. To do this, create a file named config in ~/.ssh with the following contents.
      StrictHostKeyChecking no
      FallBackToRsh no
      ConnectionAttempts 5
      UsePrivilegedPort no
      Compression no
      Cipher blowfish
      CheckHostIP no
                    If you cut-and-paste the above lines into the file, be sure to run the "dos2unix" utility on it to change the end-of-line convention to the                                UNIX/Linux standard.
    • Step 5: Test by giving the command "srun --pty /bin/bash".  The scheduler will make a default resource allocation, and open a session on a node in the batch partition, without any prompt for password.

    • [mrd20@hpc2 ~]$ srun --pty /bin/bash
      [mrd20@comp040t ~]$ module list
      Currently Loaded Modules:
      1) i/1.0.0 3) hdf5/1.8.15 5) intel/2015
      2) StdEnv 4) python/2.7.10 6) openmpi/1.8.8
      [mrd20@comp040t ~]$

      Note that the session in this case is assigned to comp040t. The modules open in the session will be inherited from your current environment on the headnode.