Report this

What is the reason for this report?

Linux adduser command needs --home Dir option

Posted on April 11, 2018

New account with “adduser user”

After ssh into root@ipAddress, I tried to create a new user account as “Initial Server Setup with Ubuntu 14.04” suggested. The new account was created, but with some anomalies:

  1. No “user@hostname” in the shell prompt
  2. No /home/user directory
  3. No /bin/bash shown in /etc/passwd
  4. Unable to “deluser user”

For example,

after “adduser leon” and login as leon: $ id uid=1000(leon) gid=1000(leon) groups=1000(leon),27(sudo) $ grep -i leon /etc/passwd leon:x:1000:1000::/home/leon: $ su root root@Leon-Ubuntu:/# deluser leon Removing user leon' ... Warning: group leon’ has no more members. userdel: user leon is currently used by process 2060 /usr/sbin/deluser: `/usr/sbin/userdel leon’ returned error code 8. Exiting.

Then I tried the “–home Dir” option

and it works well.

root@Leon-Ubuntu:/# adduser --home /home/leon2 leon2 root@Leon-Ubuntu:/# grep -i leon /etc/passwd leon:x:1000:1000::/home/leon: leon2:x:1001:1001:,:/home/leon2:/bin/bash root@Leon-Ubuntu:/# ls /home/ leon2 root@Leon-Ubuntu:/# deluser leon2 Removing user leon2' ... Warning: group leon2’ has no more members. Done.

Is there an explanation about this?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

This is odd and I cannot say that I have encountered this on Ubuntu 16.04 myself but I was able to find some information indicating that others have experienced this issue with the default adduser command in Ubuntu 16.04. It seems the issue lies with the command reading and using the defaults specified for it.

You can find some suggestions and more information here.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.