Ubuntu - User Management
Ubuntu - User and Group Management
Section titled “Ubuntu - User and Group Management”Ubuntu, like all Linux systems, is multi-user. Proper user management is crucial for security and organization. This section covers creating users via the graphical interface and managing users and groups using command-line tools.
Creating Users (Graphical Method)
Section titled “Creating Users (Graphical Method)”Modern Ubuntu desktops (using GNOME) provide a user-friendly way to manage users through the Settings application.
Step 1 − Open ‘Settings’. You can find it by clicking the system menu in the top-right corner or searching for ‘Settings’ in the Activities overview.
Step 2 − In the Settings window, scroll down the left sidebar and click on ‘Users’.
Step 3 − To make changes, you’ll need administrative privileges. Click the ‘Unlock’ button in the top-right corner of the Users panel. You will be prompted to enter your password. After authenticating, the options will become available.
Step 4 − Click the ‘Add User…’ button, which is usually green or prominently displayed once unlocked.
Step 5 − A dialog box will appear. You need to select the account type:
- Standard: For regular users with limited privileges. They cannot install software or make system-wide changes.
- Administrator: For users who need
sudoaccess to perform administrative tasks.
Enter the new user’s full name and a username (which will be automatically suggested based on the full name, but you can change it).
Step 6 − After filling in the details, you’ll be prompted to set a password for the new user. You can choose to set a password now or allow the user to set it on their first login. It is highly recommended to set a strong password immediately.
Step 7 − Click the ‘Add’ button. The new user account will be created and will appear in the list of users.
The new user account is now enabled and ready for login.
Managing Users and Groups (Command Line)
Section titled “Managing Users and Groups (Command Line)”For more advanced control, or when working on a server without a GUI, command-line tools are essential.
Key commands:
adduser: A user-friendly, interactive command for adding new users. Example:sudo adduser newusername(this will prompt for password and user details).useradd: A lower-level utility for adding users (less interactive, often used in scripts). Example:sudo useradd anotheruser(you’d then need to set a password withsudo passwd anotheruser).passwd: Change a user’s password. Example:sudo passwd username(to change another user’s password) orpasswd(to change your own).usermod: Modify an existing user account. Example:sudo usermod -aG groupname username(adds user to an additional group),sudo usermod -L username(locks an account).deluser: Remove a user. Example:sudo deluser username. Usesudo deluser --remove-home usernameto also remove their home directory.addgroup: Create a new group. Example:sudo addgroup newgroupname.delgroup: Delete a group. Example:sudo delgroup groupname.gpasswd: Administer group passwords (rarely used for passwords themselves) or manage group members. Example:sudo gpasswd -a username groupname(add user to group),sudo gpasswd -d username groupname(remove user from group).id: Display user and group information for a user. Example:id username.getent group: Display entries from administrative databases, useful for listing groups and their members. Example:getent group groupname.
Example: Creating a group and adding a user to it:
sudo addgroup projectalphasudo usermod -aG projectalpha johndoeThis creates a group projectalpha and adds the user johndoe to it. The -aG option in usermod is important: -a appends to existing groups, and -G specifies supplementary groups.
Best Practice: Use adduser for interactive user creation as it sets up a home directory, skeleton files, and prompts for a password. For managing group memberships, usermod -aG or gpasswd -a are common. Always use sudo for commands that modify system-wide user and group information.
Note: Older tutorials might mention gnome-system-tools. This package is largely deprecated. Standard system settings and command-line tools are the modern approach for user and group management in Ubuntu.