Linux adduser command needs --home Dir option
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:
- No “user@hostname” in the shell prompt
- No /home/user directory
- No /bin/bash shown in /etc/passwd
- Unable to “deluser user”
after “adduser leon” and login as leon:
uid=1000(leon) gid=1000(leon) groups=1000(leon),27(sudo)
$ grep -i leon /etc/passwd
$ su root
root@Leon-Ubuntu:/# deluser leon
leon' ...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
root@Leon-Ubuntu:/# ls /home/
root@Leon-Ubuntu:/# deluser leon2
leon2' ...leon2’ has no more members.
Is there an explanation about this?
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.