can a user be created just by adding entries in /etc/passwd,/etc/group and /etc/shadow files?

1

Can a user be added on a Linux server by editing above mentioned files instead of using commands like useradd?

In case the root user has write permissions to /etc/passwd, /etc/shadow and /etc/group files, then can the user be created just by adding required fields in these files instead of using useradd command? Can that be done?does that really create user in the same way?

priya

Posted 2019-11-10T07:21:23.127

Reputation: 11

Answers

1

Yes. For most Linux systems this is the only thing useradd does anyway.

(Although with option -m it might also pre-create the user's homedir too, filling it with contents of /etc/skel and chown'ing appropriately. When manually creating an account meant for interactive logins, you should also make sure their home directory exists.)

user1686

Posted 2019-11-10T07:21:23.127

Reputation: 283 655