Can I add users by simply adding new entries in /etc/passwd

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.)

Asked By: x.y.z liu


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.

Answered By: Sotto Voce
Categories: Answers Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.