Adding Users

When adding users, you will want the userids, groupid, and usernames to be consistent on all nodes. Before adding users, make sure your NFS shares are working properly.

Master node

Not all Linux distributions require this, but it is usually a good idea to explicitly add a group for each of your users so you can specify the groupid explicitly. For convenience, we have it match the userid for each user:

root@nano:~# addgroup --gid 7001 george
root@nano:~# adduser --home /home/george --uid 7001 --gid 7001 --gecos "George Jetson" george
Adding user `george' ...
Adding new user `george' (7001) with group `george' ...
Creating home directory `/home/george' ...
Copying files from `/etc/skel' ...
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
Adding new user `george' to extra groups ...
Adding user `george' to group `audio' ...
Adding user `george' to group `video' ...
Adding user `george' to group `gdm' ...
Adding user `george' to group `weston-launch' ...
root@nano:~# 

As we did for root, ssh keys can be created for each user. Since the authorized_keys file is located on global storage, adding the ssh key to that file will allow passwordless login to each of the compute nodes.

root@nano:~# su - jane
You are required to change your password immediately (root enforced)
su: Authentication token is no longer valid; new one required
(Ignored)
jane@nano:~$ ssh-keygen -N "" -f ~/.ssh/id_rsa
Generating public/private rsa key pair.
Created directory '/home/jane/.ssh'.
Your identification has been saved in /home/jane/.ssh/id_rsa.
Your public key has been saved in /home/jane/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:wAU4Txr6cmqZjvYo+SoP7zF/5KkBgH2jt43fxq++X9w jane@nano
The key's randomart image is:
+---[RSA 2048]----+
|     ....        |
|..  +...         |
|o ..o*o          |
| ..o....         |
|  o..   S        |
|  .oo+.    . .   |
|..o*+o.o    o E  |
|+=*+ o+.o  .     |
|*OB.oo.o==o      |
+----[SHA256]-----+
jane@nano:~$ cat .ssh/id_rsa.pub >> .ssh/authorized_keys

To test this, you should be able to use pdsh to run commands (e.g. 'hostname') on each node once you have users set up on each of the compute nodes.

Compute Nodes

Add a group first, with gid consistent with that on the master.

pdsh -w nano[01-04] addgroup --gid 7001 george

On the compute nodes, you will want to avoid any interaction since pdsh does not handle interactive requests well. Since the home directories are mounted from the master node, you will not create them when creating users on the compute nodes. Once users are created, we will set up ssh keys for internode communication, so passwords are not needed.

pdsh -w nano[01-04] adduser --no-create-home --disabled-password --uid 7001 --gid 7001 --gecos \"George Jetson\" george

Note that the quotes around "George Jetson" are escaped. This prevents them from being interpreted during execution of the pdsh command on the local node (master in this case), but they will be interpreted during execution of the adduser command on the remote nodes.

Last updated