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
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 -


{ 68 comments… read them below or add one }
i am first time use linux, How can i see all user ??
i dont know
cat /etc/passwd
type in root user
ls /home/
That will only work if there is a userfolder created for every user. And thats not necessary the case.
with command who,,,u can see all users
Sagar: cat /etc/passwd
cat /etc/passwd | cut -d”:” -f1
@Fuji : hi , cat /etc/passwd | cut -d”:” -f1 , what is the meaning of this command.Pleaswe tell ASAP.
hi,
cut -d ” ” -f1 means d is delimiter .In this command delimiter is colon(:) .field1.If the file content is like this ramnaidu7:500:501:Bh.Ram .
After issuing above command o/p is ramnaidu7 since colon(:) is the delimiter and that is considered as field1(f1)
I think the folliwng is important. You want one character after the -d, that being the separator between columns.
[root@localhost ~]# cat /etc/passwd | cut -d”:” -f1
cut: the delimiter must be a single character
Try `cut –help’ for more information.
[root@localhost ~]# cat /etc/passwd | cut -d: -f1
root
bin
daemon
adm
lp
sync
…
How to create a mail account in linux?
i can not create mail on linux. can you show me some step of mail?
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
login with root account and then change password.
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 ???
Why would give somebody root access to your machine?
Try the following
sudo -i
Enter your user password
Then when logged in as root type
passwd
to set a password for the root user.
But i don’t recommend doing this, especially because you seem not to be too fond of linux….
exellent
How do I list user passwords?
If I am not wrong you cannot list user password.
I deleted my user account in fedora 11 by mistake and now I cannot enter to linux.
What should I do?
There are no more user accounts in the system.
Alireza
Boot into single user mode and create a new account?
How can I play mp3 files in linux fedora 11.
The players in this system don’t know the mp3 files.
Alireza
Use VLC media player
use mplayer..
Hello,
Is it possible to create a new user by edit the /etc/passwd file ?
when i try to add a new line with a new user name, user ID , user comment, home directory
it doesn’t work.
What am i missing ?
Thank you all,
Gal
No, you cannot create a new user by editing the /etc/passwd. Instead you should either use a GUI to help you or use ‘useradd -p
how can i add a user without using useradd command in linux?
I have the user linux:/home/wolful
how to create linux:/home/admin ,
or how to rename user “wolful” in “admin” without the reinstallation of the linux(suse) ??
use usermod command
linux command sumit my ide
how to boot dual booting windos, linux with together press F8 key
then display windows, after press F8 key then display Linux What Coomand on the linux base
Manoj Prajapati.
SIET Gr. Noida
how to breack root password in the Linux and how to boot i m forget my root password
boot linux in run level 1 and then change password using passwd command.
Hi Guys,
Do you want to give the root access to the normal Linux user, even after the root passwd get changed?
Do follow below commands,
Login as a root user,
Let suppose the user is imtestuser
[root@girish.mahajan ~]# useradd imtestuser
[root@girish.mahajan ~]# passwd imtestuser
[root@girish.mahajan ~]# visudo
#One file get opened,
# add the below line to the file
imtestuser ALL=(ALL) NOPASSWD: ALL
#save the file.
[root@girish.mahajan ~]# su imtestuser
[ imtestuser@girish.mahajan ~]#
[ imtestuser@girish.mahajan ~]#
[ imtestuser@girish.mahajan ~]#
[ imtestuser@girish.mahajan ~]# sudo su -
[ root@girish.mahajan ~]#
# Now even after changing the passwd , ur imtestuser get authenticated without asking for passwd, and even it get changed…
–
Girish Mahajan
Continuing with above statements…
Smarter person can do like ,
[root@girish.mahajan ~]# adduser imtestuser –home /var/.imnotatheft/imtestuser
[root@girish.mahajan ~]# passwd imtestuser[root@girish.mahajan ~]# visudo
#One file get opened,
# add the below line to the file
imtestuser ALL=(ALL) NOPASSWD: ALL
#save the file.
[root@girish.mahajan ~]# su imtestuser
[ imtestuser@girish.mahajan ~]# sudo su -
[ root@girish.mahajan ~]#
# Now even after changing the passwd , ur imtestuser get authenticated without asking for passwd, and even it get changed…
Now , guys , by follwing these steps , u are creating let suppose a hidden user, having a grant to logged in to as a root user without passwd and all.
Regards,
Girya ! :)
Can I create user without root login ?
plz tell me uesr account passwd administrative sulotion
How to create user account in linux?
Hey,
there is also this option:
adduser tomer -p Liux12345
if you want to automate a scenario in which you need to define a user on a Linux machine programatically, using the above command will save you the hassle of getting prompts from the machine when defining a new user.
cheers!
Hey,
I was wondering, in linux mint can you use internet explorer 7 still? And also, how do you change operating systems, like I have Windows Vista now, I dont want to get rid of it. I want to get a different operating system though, How could I change back and forth if I didnt like it?
Hello Everybody!!!
can anyone lead me where can I find a source code for Linux?
my thanx in advance
goto http://www.kernel.org download the kernel file . it will be a compressed file . just uncompress it thatz all . it contain’s all source code of the linux kernel
what is the use of passwd -r command in solaris 10
and what is the use of useradd -k command in soalris 10
I want to modify both sides of the @.
root@userland:~#
usermod -l booboof root
now,
booboof@userland:~#
What changes userland?
Would like booboof@t:~#
$hostname t
(run as root)
reboot.
Good article, every comment above this one though sounds like a bunch of script kiddies begging for haxx00rz lol!
how to create user in linux without using useradd command………..???????/
plz reply me early as possible……………….thanx…………….
You need to use Perl or shell script and edit /etc/passwd and /etc/shadow.
Hey..
I have a linux server with 5 dedicate IPs on it.
I have created 5 users on the server and want to restrict each users with 1 specific ips..
user1 should only access the server with IP 1
user2 should only access the server only with IP 2..etc
awaiting for response
In Linux command,
-C, -D,-E
what do they mean?
Please!
Can someone answer to me?
Thanks….
how to create multiuser in linux?
is already multiuser by default
Hi:
I create a count with the name of IRAF and the next are: “IRAF Maintenance”, home directory “/iraf/iraf/local”, shell “/bin/tcsh”, and a secure password. ” In the directory it appears like “iraf:x:1001:1001::/home/iraf:/bin/sh”; wath does it means?
…i’m a beginner, then I can’t find the properties and the user privilegies in the tabs. Where are they? I need it for the installation of IRAF in my UBUNTU 32-bit o.s.
I created another user account, but they cannot edit what they need to edit. How can I select a folder and have them be able to edit anything within that folder?
either make the user/ group of users owner of the directory
use chown
or change the permissions of the directory as read write [execute] to all
sudo chmod 777 -R
#with absolute path
how to insatall SAM in linux
This is really helpful. I have a linux virtual machine, and it uses backtrack 5 as an interface. I hope this works. :D
THanks! This is helpful to add new user and password. How to change password?
if you are logged in as that user, use
passwd
if you are logged in as root and want to change the password of another user use
passwd username
how to create a user without using useradd cammand…
Just use it…. or use a gui application, but i don’t see why you’d need that.
Hello guys,
I have a vps that I must share with my developer and assistants, how can i prevent file download from server and allow just uploads?
or how can i protect my files in vps from being downloaded ?
what I must do?
Thanks