Home   |   Guides and Tutorials   |   What's New?   |   Comments   |   About
 

adduser: Adding A New User

by Tammy Fox
Last Modified: Wednesday, 19-May-2004 11:55:28 EDT

Using the Command Line
    Note: You must have root access to add a user. If you are logged in as a regular user and know the root password, you can type the command su. This will prompt you for a password. Enter the root password correctly and you will have root priviledges until you type exit. Typing exit will take you back to regular user mode.
    After changing to root, the command adduser can be used to add users to your machine. In Red Hat Linux, the adduser command is located in the /usr/sbin directory. To invoke the command you might have to type /usr/sbin/adduser (the full path) if /usr/sbin is not in your path. For further information about adding to your path see the Setting Your Path guide. To add a user with the default values for the user's home directory and shell type, simply type the following command:
adduser username where username is the name of the user you wish to add.

In Red Hat Linux, the default home directory is /home/username, and the default shell is the bash shell. The adduser command has many other options to choose from. Below is a list of all switches for the adduser command.
adduser  [-u uid [-o]] [-g group] [-G group,...]
[-d home] [-s shell] [-c comment] [-m [-k template]]
[-f inactive] [-e expire mm/dd/yy] [-p passwd] [-n] [-r] name
adduser  -D [-g group] [-b base] [-s shell] [-f inactive] [-e expire mm/dd/yy]
    The -D switch is used to either view the current default values for adding a user or to change the default values for adding a user. Typing adduser -D will display the default settings.
    To use the switches, type adduser -switch switchvalue. For instance, to add the user bob with the home directory of /home/users/bob, type the following command:
adduser bob -d /home/users/bob.
    The last step to adding a user is to set the user's password. To do so, type the following command:
passwd username (where username is the username of the new user)
This will prompt you to enter a password. Enter the password and press enter. You will be asked to confirm the password. Type the password in again and press enter. As long as you typed the same password in both times, you have finished adding a new user. If you did not enter the same password both times, you will be asked to reenter the password again until you confirm it correctly.

    For additional information about groups see the groupadd: Adding a New User Group guide.

Using Linuxconf
    Note: You must have root access to add a user. If you are logged in as a regular user and know the root password, you can type the command su. This will prompt you for a password. Enter the root password correctly and you will have root priviledges until you type exit. Typing exit will take you back to regular user mode.
    After changing to root, invoke the Gnome Linuxconf GUI Tool by typing linuxconf. In Red Hat Linux, linuxconf is found in the /bin directory. Thus, if it is not in your path, you must type /bin/linuxconf. For further information about adding to your path see the Setting Your Path guide. Once linuxconf has started, choose Config->User Accounts->Normal->User Accounts from the menu tree on the left. After choosing User Accounts, your screen should look like below.



    To add a user from here, click Add. A new screen should appear. From the user account creation screen, fill in all the required fields. The screen should then look like below:



    After filling in all the fields, click Accept. This will produce a screen in which you can enter a password for the user.



    Enter a password, and click Accept once again. You will be prompted to reenter the password for verification purposes. Then, the user accounts page will appear. You will know if you added the user successfully if you see your new user in the user list. Click Quit to exit the user accounts section. Then, click Quit again and activate changes, and you can then begin using your new user account.

What's Related


All Rights Reserved Linux Headquarters © 2000-2007
Linux is a registered trademark of Linus Torvalds
All logos are registered trademarks of their respective owners
Last modified: Wednesday, May 19, 2004