User Management

From ArchWiki

Jump to: navigation, search
Summary
An introductory guide to managing user accounts on Arch Linux.
Related
Groups

Users and groups are used on GNU/Linux for access control. That is, to control which users and services are allowed access to devices and files on the system. This article describes how to add, delete, and manage user accounts on Arch Linux using common system management commands. Whilst certain desktop environments provide graphical user management tools, they are not discussed here.

Contents

Overview

A user is anyone who uses a computer. In this case, we are describing the names which represent those users. It may be Mary or Bill, and they may use the names Dragonlady or Pirate in place of their real name. All that matters is that the computer has a name for each account it creates, and it is this name by which a person gains access to use the computer.

Managing users is done for the purpose of security by limiting access in certain specific ways.

Also, any individual may have more than one account, as long as they use a different name for each account they create. Further, there are some reserved names which may not be used, including "root", "hal" or "adm".

Finally, users may be grouped together into a "group", and users may choose to join an existing group to utilize the privileged access it grants.

Note: The beginner should use these tools carefully and stay away from having anything to do with any other existing user account, other than their own.

Adding users

To add a new user, use the useradd command:

# useradd -g users -G group1,group2{,...} -m USERNAME

This command will create a new user named USERNAME belonging to the users group (GID 100 by default) and the specified supplementary groups. Groups are discussed below, and must be comma-separated.

For more advanced uses of useradd, type:

$ man useradd

To specify the user's password, type:

# passwd USERNAME

adduser

A guided tool is available for adding users:

# adduser

adduser asks common questions about the user with sane defaults and constructs a useradd command to run. It also sets the password and changes finger information.

Deleting users

User accounts may be deleted with the userdel command.

# userdel -r USERNAME

The -r option specifies that the user's home directory and mail spool should also be deleted.

Listing users

Local user information is stored in the /etc/passwd file. To list all user accounts on the system:

# cat /etc/passwd

To list users currently logged on the system, the who command can be used.

Groups

See the groups article for a more comprehensive list of Arch's user groups and group manipulation commands. Below is a list of the important groups that you might have a user join.

Information on default important groups in Arch Linux.
Group Description
audio Enables use of speakers.
floppy Allows access to any floppy drives.
network Enables the user to change network settings.
optical Enables the user to access the CD drive.
storage Enables the user to mount storage devices through HAL and D-Bus.
video Allows direct access to video components (X can be used without belonging to this group).
wheel Allow access to the root account through tools like sudo (if you enabled it via visudo).
Personal tools