I am adding a new node to my small "cluster". I would like the new node to have exactly the same accounts (for human users) on it. I tried to copy the human user entries from other node to this new node but I cannot login via ssh using these added account. Have I successfully added the new accounts by simply adding new entries in the /etc/passwd file? How can I examine it? (I googled about how to list all human users but all points to showing the content of /etc/passwd.)
1 Answer
With most Linux systems, the absolute minimum to create for a local user is an entry in /etc/passwd
and the corresponding entry in /etc/shadow
. Many times there's also a group with the same name in /etc/group
.
Creating the user's home directory is also useful in most cases, depending on whether the home directory already exists on a file server and is automounted on the servers in your cluster. The ssh authorized_keys file may be useful (as a comment already points out), and this is typically in a subdirectory under the home directory.
Using utility programs like adduser
or useradd
takes care of these steps for you. One command covers everything except the ssh key.
-
Thanks. Copying /etc/shadow solved my problem. I have almost 20 users so copy these two files is much faster for me than using
useradd
to create accounts one by one. Commented Jul 14, 2023 at 2:51
/etc/shadow
entries (if you're using passwords)?