In Ubuntu, users are accounts that can log in to the system and use its resources. Each user has their own username and password, which are used for authentication when logging in. Users in Ubuntu can have different levels of access and permissions depending on their settings and privileges. For example, a superuser (root) has full access to all system resources, while regular users may have limited access rights.
Superusers in Ubuntu are users who have full access rights to all system resources and can perform any operation, including changing system settings and managing devices. One of the most well-known superusers in Ubuntu is the "root" user, who has absolute access to all system resources. Superusers are typically used to perform tasks that require high privileges, such as software installation, system configuration, and other administrative operations.
For various reasons, you may need to view registered users on your system. It is also sometimes necessary to change the group for a particular user. Experienced users can certainly solve this task in two mouse clicks, but beginners often have difficulties with it as well. In this article, let's see how to view all users who have registered with the help of graphical utilities and the terminal.
The most justified and universal way is to view all users in the Linux terminal. It works in almost all distributions of the operating system, so you should start there. In Linux there is /etc/passwd, so it stores all the information about all users.
The entries in the file are as follows:
username_username password id id_group group group home_directory shell
It should be noted here that for security reasons the passwords have been moved to a separate file, so you won't be able to see them here. To familiarize yourself with the list of users, you should run the command:
$ cat /etc/passwd
We can see that there is a large amount of data in the file, and not all of them are needed at a certain time. Therefore, in order to simplify the task, it is worth using a special filter. It is activated by the command:
$ sed 's/:.*//' /etc/passwd
Now you will be able to see only users who have registered in the system. Another useful feature is to see which users are active and who is engaged in what processes.
To do this, use:
$ w
The list will display the list of commands being executed. If there are several commands being executed, they will be displayed as a column in the list. You can also see the history of user logins. For this purpose there is the command last, it displays information based on the /var/wtmp
log:
$ last –a
To see when a user last logged in, type:
$ lastlog
If he or she has never logged in, you will see an alert. In any other case, a specific date will be displayed.
The Ubuntu system gives you the ability to manage the users registered on the system through settings. To begin with, open the utility and at the very bottom find the menu item "Accounts". The left column directly lists users, the right column lists data and settings.
KDE has an interesting user management utility called KUser:
The interface resembles a terminal. You can do all the same things: change passwords, different user data, main and auxiliary groups.
But in the terminal you can still see when the last login was performed and whether other users are using the system. This is not the case here. However, this functionality will be enough for some people.
That's all, to see the list of users in Ubuntu is very simple. It is enough to understand the basics of this process.
User groups in Ubuntu (and Linux in general) are a way of organizing users into categories, which allows you to manage access rights and permissions more efficiently. A group is a collection of users who can be assigned shared permissions to files and system resources. Each user can belong to one or more groups.
File and directory permissions in Linux are defined for three categories: owner, group, and all other users. This allows you to restrict access to resources to only certain groups.
You can create groups using the groupadd command.
For example:
sudo groupadd mygroup
To add a user to a group, use the usermod command:
sudo usermod -aG mygroup username
The -aG flag adds the user to the specified group without removing the user from other groups.
To see which groups a user belongs to, you can use the command:
groups username
Group information is stored in the /etc/group file. Each line of this file contains the group name, the group identifier (GID), and a list of users belonging to that group
Ubuntu has predefined groups such as sudo (for users with administrator privileges), adm (for system administrators), and others. Using groups simplifies system administration and access rights management, especially in multi-user environments.