useradd - Create A New User
Although a user can be added to the system by directly editing the /etc/passwd file, a much safer way to add users is by this command. A mistake in editing the passwd has potentially serious effects and additional information must be added to the actual password file /etc/shadow. For example changing the shell for any account to a nonexistent shell will lock out that account, which is very serious if that happens to the root account. The author speaks from experience having recently done exactly that. The only recovery from this type of mistake is to reboot the system from a rescue CD and repair the passwd file. Adding users through the useradd command will prevent any such accidents. Notice that from the chart the two options, the d and s options, will override some system defaults when adding a user. An example using this command is:
useradd newuser -c user_full_name -d /home/newuser -s /bin/bash
This would add a new user with the userid of newuser, a home directory of /home/newuser, and a default shell of bash. It would also create the users home directory and copy any files in the /etc/skel directory into the new user directory, properly initializing this new account as well as storing the users full name in the comment field in the /etc/passwd file.
Some versions of useradd will also create a group with this account name. Check your system command page for useradd to find out whether or not your system will create a group with this command.
Home - Table Of Contents - Contact Us
CertiGuide to A+ (A+ 4 Real) (http://www.CertiGuide.com/apfr/) on CertiGuide.com
Version 1.0 - Version Date: March 29, 2005
Adapted with permission from a work created by Tcat Houser et al.
CertiGuide.com Version © Copyright 2005 Charles M. Kozierok. All Rights Reserved.
Not responsible for any loss resulting from the use of this site.