0

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

2
  • Did you also copy the authorized keys (if you're using public key authentication) or /etc/shadow entries (if you're using passwords)?
    – muru
    Commented Jul 14, 2023 at 0:44
  • I have the entire /home folder shared, so the keys are already there. I don't know about /etc/shadow which is probably the reason.
    – x.y.z liu
    Commented Jul 14, 2023 at 2:43

1 Answer 1

1

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.

1
  • 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.
    – x.y.z liu
    Commented Jul 14, 2023 at 2:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .