On a Linux server, you manage access and permissions through users and groups. A user has their own account with permissions on files and processes, while a group bundles multiple users so you can assign permissions all at once. In this article, we explain how to create, modify, and delete users and groups, and how to manage this securely on a VPS or dedicated server.
What are users and groups
Every Linux system works with accounts (users) and collections of accounts (groups). Each user gets a unique UID (user ID) and each group a unique GID (group ID). Files and folders have owners and group owners, allowing you to determine exactly who may read, write, or execute them.
There are two types of users: system users (for services like web servers or databases) and regular users (for people who log in via SSH). Groups are often used to, for example, give multiple developers access to the same project folder without everyone needing root privileges.
Creating and managing users
You create a new user with the command useradd or the more interactive variant adduser (available on Debian/Ubuntu). Below are the most commonly used commands.
Create a new user
Use sudo adduser username to create a user with a home directory and default settings. On CentOS/AlmaLinux, use sudo useradd -m username followed by sudo passwd username to set a password.
View user information
With id username you see the UID, primary group, and any additional groups. The command cat /etc/passwd shows all accounts on the system.
Modify a user
Use usermod to change settings, for example sudo usermod -aG sudo username to add sudo privileges. The -a (append) option is important, otherwise existing group memberships will be overwritten.
Delete a user
With sudo deluser username or sudo userdel username you remove an account. Add --remove-home to also delete the associated home directory.
sudo, but continue working from a regular account.Creating and managing groups
You create groups with groupadd. This is useful when multiple users need the same access to files or folders, for example a team working together on a website.
sudo groupadd developerscreates a new group.sudo usermod -aG developers usernameadds an existing user to the group.groups usernameshows which groups a user belongs to.sudo gpasswd -d username developersremoves a user from a group.sudo groupdel developersdeletes a group that is no longer used.
Each user is automatically assigned a primary group upon creation, usually with the same name as the user itself. In addition, a user can be a member of multiple secondary groups, allowing you to flexibly combine permissions without separate settings per file.
Permissions and secure management
Permissions on files and folders are determined by owner, group, and others, each with read, write, and execute rights. With chown user:group file you change the owner and group, and with chmod you set the permissions yourself, for example chmod 750 folder for full access for the owner, read access for the group, and no access for others.
For websites running through Plesk, user permissions are often managed automatically via the panel: each hosting account gets its own system user with limited permissions, so sites cannot affect each other. At Tandata, you’ll find this under the settings of each plan within /nl/webhosting/, where Plesk applies user separation by default.
Regularly check which users and groups exist on a server, remove accounts that are no longer needed, and limit sudo privileges to those who really need them. This prevents a compromised account from immediately granting full access to the server.
Frequently Asked Questions
What is the difference between useradd and adduser?
useradd is a low-level command available on almost every Linux distribution, but requires more manual configuration. adduser is an interactive script that guides you through the process and sets up a home directory and password by default.
How do I give a user sudo privileges?
Add the user to the sudo group (Debian/Ubuntu) or wheel group (CentOS/AlmaLinux) with, for example, sudo usermod -aG sudo username.
Can a user be a member of multiple groups?
Yes, a user has one primary group but can be a member of multiple secondary groups at the same time, enabling flexible permission management.
What happens to files when I delete a user?
Files remain but get a numeric owner (the old UID) instead of a name. Use --remove-home with userdel to also clean up the home directory.
How do I see all groups on a server?
With cat /etc/group you get an overview of all groups and their members on the system.
Conclusion
Users and groups form the foundation of access management on a Linux server. With commands like useradd, usermod, and groupadd you can quickly determine who has access to which files and permissions. Keep accounts organized, limit sudo privileges, and regularly check who is still active.