2. Setting up SSH password-less log in

1. Define a common user for all the machines with the same user name and make the home directory /mirror

madhawa@node0:~$ sudo useradd -d /mirror/mpiuser -m -s /bin/bash mpiuser
madhawa@node0:~$ sudo passwd mpiuser

This would prompt for a new password for the user id "mpiuser". Do the same thing to all the machines.

2. Make the mpiuser as the owner of the /mirror

madhawa@node0:~$ sudo chown mpiuser /mirror

3. Install the SSH server in all the machines.

madhawa@node0:~$ sudo apt-get install openssh-server

4. Setup the password-less log in.

login with the new user in su mode.

madhawa@node0:~$ su mpiuser

Generate DSA key pair for the mpiuser.

mpiuser@node0:~$ ssh-keygen -t dsa

This will prompt for a passphrase. Leave it empty. 

A folder called .ssh is created in /mirror/mpiuser which contains the key file. Add this key to the authorized set of keys by issuing the following commands.

mpiuser@node0:~$ cd .ssh
mpiuser@node0:~/.ssh$ cat >> authorized_keys
mpiuser@node0:~/.ssh$ chmod 644 authorized_keys 

To test the password-less login, issue the following command on the master node and if successful, this would return the host name of the nodes without asking for password or passphrase.

mpiuser@node0:~$ ssh node1 hostname

Note: Sometimes you may be prompted to enter password for once. But it won't be required again. 

No comments:

Post a Comment