Ask all your coding questions @ codequery.io

Understanding how users, groups, and permissions work on Linux can be challenging at first. In this tutorial, we'll explore the basics of system administration for Linux environments. We'll define the different types of users and how to add and remove users to/from the system. Additionally, we'll discuss basic commands like chmod and chown and how they can be used to modify permissions for different users/groups in Linux.

Linux Users

Linux is designed for multiple users to have access to the same system at the same time. There are three types of users in Linux:

System users

System users run non-interactive or background processes. These users don't have their own login or home directory.

Regular users

These users run interactive processes and have their own home directory and login.

Super user

There is only one root or superuser. This user is the ultimate authority on file ownership and permissions. You create new users as the root user.

Linux - Viewing all users

$ cat /etc/passwd

You can view a list of all users on the system via:

This shows every user on the system. Each line represents a user with basic information such as username, user ID, group ID, and the home directory for that user.

Linux - Switching to the root user

How you switch to the root user may vary depending on your Linux distro. For Ubuntu, you can run:

$ sudo su