Create New User on Linux Command line

To quickly create a new user from the linux terminal:

(short version)

$ sudo adduser *username*
$ sudo usermod -aG *groups* *username*

If your system doesn’t use sudo, switch to root instead, and run above commands without the sudo part.

Details

(long version)

$ sudo adduser username

This will ask for some more details about the user, like their password, name, address, phone number, etc.

You need to enter the password. You can leave the other fields blank and just hit enter until it asks to confirm that the information is correct, and enter ‘y’ when it does.

To add this user, say, moom to groups:

$ sudo usermod -aG #[space separated list of groups] moom

eg:

$ sudo usermod -aG sudo username web jesters moom

That’s it.

More information

Learn more from this reference.

Gory details

Useful manpages: adduser, useradd, userdel, usermod, groupadd, groupdel, groupmod