The three commands for creating users in Debian based Linux distros are useradd, adduser and newusers.
The generical useradd command:
The useradd command is universal, the same for all the Linux distributions. I wrote an article about the useradd command here.
The adduser command:
The adduser command is userfriendly and interactive.
Syntax: adduser username
$ sudo adduser deb
Adding user `deb' ...
Adding new group `deb' (1013) ...
Adding new user `deb' (1011) with group `deb' ...
Creating home directory `/home/deb' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for deb
Enter the new value, or press ENTER for the default
Full Name : deb
Room Number :
Work Phone :
Home Phone :
Is the information correct? [Y/n] Y
You are given a UID (the first one available), added to a group with the same name as your new user, created and assinged a homedir (/home/username), you get the data from the /etc/skel directory copied in your ~ , asked to insert a password (twice), to fill in some extra information (you can skip by pressing 5 times enter) and at the end, asked to confirm. (Y is Yes and N is no)
$ grep deb /etc/passwd
And it worked.
The newusers command:
The newusers command is usefull when you have to add (or update) an entire list of users. And it is very simple to use.
Syntax: newusers filewithusers
The file that contains the “to be added users” has the same structure as the /etc/passwd file.
structure: username:password:user_id:group_ip:other_info:homedir:login_shell .
I often fill in only the username,password and the login shell (and get the UID and GID by default). Like this:
$ cat filewithusers
$ sudo newusers filewithusers
$ tail -3 /etc/passwd
The passwords for the new users are the ones written in the list. But in /etc/shadow they are stored in a crypted format.
Example of /etc/shadow line:
$ sudo grep wolverine /etc/shadow