Default shell not being selected with useradd
This is a known bug in Ubuntu's useradd
(added by a Ubuntu-specific patch). It ignores all the settings specified in /etc/default/useradd
...
The workaround, as indicated in maulinglawns' answer, is to use adduser
instead, which is the recommended tool for adding non-system users in Debian derivatives.
Oddly enough, this happened to me too yesterday on a server running Ubuntu 16.04 LTS.
I have no concrete answer as to why this happens, but here is a quick solution that worked for me:
Don't use useradd
, use adduser
instead!
DESCRIPTION
adduser
andaddgroup
add users and groups to the system according to command line options and configuration information in/etc/adduser.conf
. They are friendlier front ends to the low level tools likeuseradd
,groupadd
andusermod
programs, by default choosing Debian policy conformant UID and GID values, creating a home directory with skeletal configuration, running a custom script, and other features.
As for sudo
, you have to log out that user — and then log back in — for the new group settings to have an effect.
Here's a good link on useradd
vs adduser
.