1

This question already has an answer here:

I am adding a user named 'test' in my Ubuntu 18.04 server. When I add the user using adduser, like this:

sudo adduser --system --group test --shell /bin/bash

all goes well, I can login fine, but .bashrc, .bash_logout and .bash_profile are not made by default in the home dir. Whereas when I added the user using useradd like this:

sudo useradd -m test -s /bin/bash

the user is added in the same way as adduser and I have a preconfigured .bash_profile, .bashrc and .bash_logout in the home dir.

Can someone explain why is there a difference ? Am I missing any flag in adduser usage ?

marked as duplicate by pa4080, karel, Eric Carvalho, Fabby, RoVo Dec 21 '18 at 12:24

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

This behavior of adduser is due to the option --system. With this option you are create a system user, with UID under 1000. From man adduser:

If called with one non-option argument and the --system option, adduser will add a system user... A home directory is created by the same rules as for normal users. The new system user will have the shell /bin/false (unless overridden with the --shell option), and have logins disabled. Skeletal configuration files are not copied.

The skeletal configuration files are these files, located in /etc/skel, that are copied do the user's home directory when a new normal user is added to the system.

If you want to add a normal user, by default, you do need to add any options to adduser, just use:

sudo adduser username

On the other hand, if you want to create fully qualified normal user by adduser you need to add few additional options, for example -m to create user's home directory and copy the content of /etc/skel.

  • Oh, my bad I didnt read the manual correctly. Got it, thx ! – Adithya Dec 18 '18 at 14:16

Not the answer you're looking for? Browse other questions tagged or ask your own question.