Q. How do I create create a new Linux user account ? How do update or modify default Linux new user information? Using the command prompt (shell) tools, how do I add a user to the system? What are command line options for adding a user?
A. To create a new user account under any Linux distribution use command called useradd. The system administrator is responsible for creating account. Login as root user (or use sudo command).
useradd command syntax
useradd [options] {username}
Depending on command line options, the useradd command will update system files (/etc/passwd and /etc/shadow file with password) and may also create the new user's home directory and copy initial files.
Linux add a new user called rakhi
Type the command as follows:
useradd rakhi
Set a password for rakhi:
passwd rakhi
Without password user account will be in locked status. To unlock the account, you need to use above passwd command. Use passwd command to assign a password and set password aging guidelines.
Set account disable date
You can set date for the account to be disabled in the format YYYY-MM-DD with -e option while creating account itself:
useradd -e {yyyy-mm-dd} {username}
useradd -e 2008-12-31 jerry
Set default password expiry
The -f {days} option set 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.)
useradd -f {days} {username}
useradd -e 2009-12-31 -f 30 jerry
- Email FAQ to a friend
- Printable version
- Rss Feed
- Last Updated: 11-21-08

{ 9 comments… read them below or add one }
i am first time use linux, How can i see all user ??
Sagar: cat /etc/passwd
How to create a mail account in linux?
Thanks this was helpful.
To view all the users the command is :who
thanks alot. It looks simple and I will continue learning
hi
i cant create password for my user
errore: dab password: it is based on a directory word.
It was a really simple & useful tutorial.
@Mehdi: Try something difficult;t as your password. Linux is intelligent enough to disallow simple dictionary word as password.
Say for example you can try: awk007
i just laod ubuntu and there is no option for PW during the installation now somw want to access my machine through SSH and asking for root PW how can i create the pw for root as well as other account and pw , please guide me ???