Pin Me

How to Add Users to Your Debian or Red Hat System

written by: Tolga BALCI•edited by: J. F. Amprimoz•updated: 8/9/2010

In the Linux and UNIX world, the “user” is a very important concept. The users and groups they belong to determine their folder locations, system-wide rights and many other system related issues. Here is how to add users to your system in the Red Hat and Debian distributions.

  • slide 1 of 4

    Introduction

    There are many reasons why you may want to add users to your system: your company may just have hired an employee and they need to login to the system, or your child has become old enough to use a computer and you don’t want him to mess with your own files, folders and preferences, therefore you want to open a new account on your shared computer.

    Adding users in all UNIX systems (including Linux, BSD and other Unices) takes a couple of seconds. Due to the wonderful nature of UNIX, adding a user automatically defines personal folders and other personal information, if you fill them out.

  • slide 2 of 4

    Red Hat Linux

    RedHat Add User Dialog There are two ways that you can add users to your system: using the command line and the graphical tool.

    To add a user from the command line, open up a terminal and switch to the root account by issuing the su command and typing the root password. Then use the command useradd followed by a space and the username as the argument.

    For example, if you want to add me to your system with the username tolgabalci, then the command will be useradd tolgabalci

    After you issue the command, you will be prompted to enter the user’s password twice. When done, your user is added to the system, with their /home directory and login shell defined.

    The second option is using the graphical interface. You can either go to System Settings -> Users & Groups or open up a terminal, switch to root, and issue the redhat-config-users command. In both cases you will have the same configuration window.

    In the window, click “Add User” in the top left and a dialog box will open to enter the username and password. The home directory of the user is created automatically and their default login shell is defined.

  • slide 3 of 4

    Debian and Debian-based Distributions

    Gnome Add User Dialog Debian and Debian-based distributions (such as Ubuntu) use almost the same command: adduser instead of useradd - which I find more intuitive. The command, arguments and usage are the same.

    Following our previous example about adding me to the system, open up a terminal and issue the command adduser tolgabalci and enter the password twice.

    If your system does not have root access or the root password defined, then you can issue the command with sudo, i.e. sudo adduser tolgabalci

    If you are using Gnome, you can go to System -> Administration -> Users and Groups, or if you’re using KDE, you can go to System -> Users and Groups and click on “Add User.” Fill out the dialog box as necessary and upon clicking “OK” your user will be created.

  • slide 4 of 4

    Conclusion

    Adding users from the command line is very easy. I suggest using the command line as opposed to the graphical interface because there are some issues that users face said graphical tools, such as not creating the necessary files, while the command line tool worked properly.