Ubuntu 14.04: New user created from command line has missing features
First notice that it's better to use adduser and not useradd.
- What is the difference between adduser and useradd?
- https://unix.stackexchange.com/questions/121071/what-does-adduser-do-that-useradd-doesnt
Now back to your command:
You should run the command in the following manner:
sudo useradd -m -c "Samwise the Brave" sam -s /bin/bash
man useradd
-s, --shell SHELL
The name of the user's login shell. The default is to leave this
field blank, which causes the system to select the default login
shell specified by the SHELL variable in /etc/default/useradd, or
an empty string by default.
-m, --create-home
Create the user's home directory if it does not exist. The files
and directories contained in the skeleton directory (which can be
defined with the -k option) will be copied to the home directory.
By default, if this option is not specified and CREATE_HOME is not
enabled, no home directories are created.
So you miss to use -s
to add your login shell and the -m
to create your home.
If you want to add multiple users in the same time, it's better to use the command newusers
. It'll simplify your task.
man newusers
DESCRIPTION
The newusers command reads a file of user name and clear-text password
pairs and uses this information to update a group of existing users or
to create new users. Each line is in the same format as the standard
password file (see passwd(5)) with the exceptions explained below:
pw_name:pw_passwd:pw_uid:pw_gid:pw_gecos:pw_dir:pw_shell
Here some tutorial about newusers
command:
- http://www.sanfoundry.com/newusers-command-usage-examples/
- https://opensourcewin.wordpress.com/2013/03/04/how-to-create-multiple-users-in-linux-newusers-command/
Create user
Create user's home directory
Define login shell
useradd -m -d /home/username username -s /bin/bash
Delete User
Deleter User's Home Directory
userdel -r username