Configure ssh for MPI

From SourceWiki
Jump to navigation Jump to search

To be able to run the TELEMAC system in parallel on a network of computers via MPI, one has to be able to log in to any of the machines without having to enter a password. This can be done easily with ssh keys. This article describes the methodology to setup password less login vi ssh for MPI applications.

Principle of key authentication

The principle of key authentication is the following. A keypair consists of private key and a public key

More info on wikipedia.

Key generation on master

ssh-keygen -t dsa

Note: if your network of computers for the parallel computations is on a safe private network, you can consider using a blank key. However, this is not recommended and using ssh-agent with a long key is usually the preferred option.

Copy the key to the slaves

master$ scp .ssh/id_dsa.pub login@slave01:
master$ ssh slave01
slave1$ mkdir .ssh
slave1$ chmod 0600 .ssh
slave1$ cat id_dsa.pub > .ssh/authorized_keys
slave1$ rm -f id_dsa.pub

Now go back to the master node and try to log into slave01. You should be asked for the key this time:

master$ ssh login@slave01
Enter passphrase for key '.ssh/id_dsa':

Note that if you are using a blank key, you will not be asked for a password and will be logged in automatically.

Advanced features

ssh-agent or using a blank key?

ssh-agent running ssh-add

master$ ssh login@slave1 slave01$

List of keys to use

from "master, slave01, slave02" sdvkms;dflmk