Q. How do I add a new user using command line tools? What are command line option recommended.
A. You need to use useradd command, which is responsible for creating a new user or update default new user information
The useradd command creates a new user account using the values specified on the command line and the default values from the system. The new user account will be entered into the system files (/etc/passwd) as needed, the home directory (/home/username) will be created, and initial files copied, depending on the command line options.
Task: Add a user to the system
Syntax is as follows for useradd command:
useradd <username>
By default user account is locaked, you need to setup a new password:
passwd <username>
For example add a new user called tom and set password to jerry:
# adduser tom
# passwd tom
If you want to add a user to group read how to add a user user to group
List of common options:
- -c comment: Add a comment for the user
- -d home-directory: Create a new home-directory
- -e yyyy-mm-dd: Date for the account to be disabled
- -f days: Number of days after the password expires until the account is disabled. (If 0 is specified, the account is disabled immediately after the password expires. If -1 is specified, the account is not be disabled after the password expires.)
- -g group-name: Primary Group name or group number for the user's default group (group name must exist)
- -G group-list: List of secondary additional (other than default) group names or group numbers, separated by commas, of which the user is a member (group name must exist)
- -m: Create the home directory
- -M: Do not create the home directory
- -s: User's login shell (default /bin/bash)
To read all command line option type following command:
$ man adduser
Featured Articles:
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- My 10 UNIX Command Line Mistakes
- Linux: 20 Iptables Examples For New SysAdmins

- 25 PHP Security Best Practices For Sys Admins
- The Novice Guide To Buying A Linux Laptop
- 10 Greatest Open Source Software Of 2009
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- Top 20 OpenSSH Server Best Security Practices
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Linux Video Editor Software
Facebook it - Tweet it - Print it -

{ 10 comments… read them below or add one }
thanks for your information.
Thank you
how do you set limits such as disk quota ?
For example add a new user called tom and set password to jerry:
# adduser tom
# passwd tom
passwd in example should be:
# passwd jerry
Its actually
useradd or adduser tom
passwd tom
The following prompt will come up after you input “passwd tom” than type jerry
New UNIX password: jerry
Use the command called ‘quota’ to set limits for disk usage.
hi please how can i change the acces pasword the ftp server ton enter in my server ebrunie-voip?
i wont to change the access to protect my server agains some fraud.
thank
panye
i was looking for differences between ‘useradd’ and ‘adduser’, but you seem to mix both….
see this:you first talk about useradd, then you put an example with adduser !
How can i manage user from Command Line
Let suppose i create user spiderman and grant Superuser like root!
Is it possible to create user and password in single cmd?
useradd -m user1 -p passwordforuser1
Be sure to man useradd as there are a bunch of other options that this article leaves out like adding keys, names, passwords, and other things. man is your friend learn to use it or you will hate life in linux/unix