View groups in linux. Linux: creating a group and adding a user to the system. Accounts in Gnome

I touched on the issues of user membership in a group, as well as the fact that users and groups have their own UID And GID. The topic of . Today I would like to systematize knowledge about local user base on Linux, how manage users and about files responsible for user management.

Linux is a multi-user operating system. Every user in Linux belongs to one core group and one or more additional groups. In Linux, as in most other operating systems, working with users consists of a set of the following manipulations: adding a user/group, deleting a user/group, modifying user/group settings. These manipulations are performed using the commands: useradd, groupadd, userdel, groupdel, usermod, groupmod, and passwd, gpasswd, id. In more detail: There are also graphical user administration tools, usually they are located in the X shell in the section Administration - Users and Groups.

Features of user management in Linux

Example of adding a user using a shell:

User-add-server:~# groupadd test user-add-server:~# useradd -c "Test Test" -g test -m test user-add-server:~# passwd test Enter the new UNIX password: Re-enter the new password UNIX: passwd: password updated successfully user-add-server:~# id test uid=1001(test) gid=1001(test) groups=1001(test) user-add-server:~# ls -ld /home/test / drwxr-xr-x 2 test test 4096 Dec 16 10:24 /home/test/ user-add-server:~#

In the example, we add a group for a new user (groupadd), then create a new user with full name Test Test, which has a main group test and login test, then set a password for the user test (passwd test) and check the parameters of the created user (id and created user directory /home/test/). The listing shows that the UID and GID are more than 1000. This feature is a sign regular user. Values ​​below (less than) 1000 (and on some distributions less than 500) indicate that the user is system user.

According to the agreement, system users usually have an id less than 100, and root user has an id equal to 0. Automatic numbering of regular users starts with values UID_MIN , set in the file /etc/login.defs, this value is usually set to 500 or 1000.

Besides regular user accounts and user account root, there are usually several in the system accounts special purpose for daemons such as FTP, SSH, mail, news, etc. These accounts often manage files, but cannot be accessed through regular login. Therefore they usually have login shell, defined as /sbin/nologin or /bin/false so that attempts to register with the system will fail.

On some systems, the add user command(s) have extended functionality. That is, for example, the useradd command in the Fedora and Red Hat distributions by default creates a new group for a new user and to cancel this function, you must use the -n option. To clarify such questions, you must refer to the distribution documentation.

When a user is deleted, his directory is not deleted. As a result, you can get an interesting situation:

User-add-server:~# userdel test user-add-server:~# groupdel test user-add-server:~# ls -ld /home/test/ drwxr-xr-x 2 1001 1001 4096 Dec 16 10:24 /home/test/ user-add-server:~# groupadd test123 user-add-server:~# useradd -c "Test Test" -g test123 -m test123 user-add-server:~# ls -ldn /home/ test* drwxr-xr-x 2 1001 1001 4096 Dec 16 14:30 /home/test drwxr-xr-x 2 1001 1001 4096 Dec 16 14:29 /home/test123 user-add-server:~# ls -ld / home/test* user-add-server:~# ls -ld /home/test* drwxr-xr-x 2 test123 test123 4096 Dec 16 10:24 /home/test drwxr-xr-x 2 test123 test123 4096 Dec 16 14 :25 /home/test123 user-add-server:~# passwd test123 Enter new UNIX password: Re-enter new UNIX password: passwd: password updated successfully user-add-server:~# su -l test123 test123@user-add- server:~$ pwd /home/test123 test123@user-add-server:/home/mc-sim$ ls /home/ mc-sim test test123 test123@user-add-server:~$ cd /home/mc-sim / test123@user-add-server:/home/mc-sim$ ls -la total 24 drwxr-xr-x 2 mc-sim mc-sim 4096 Nov 15 12:31 . drwxr-xr-x 6 root root 4096 Dec 16 14:25 .. -rw------- 1 mc-sim mc-sim 99 Nov 15 13:45 .bash_history -rw-r--r-- 1 mc-sim mc-sim 220 Oct 1 17:42 .bash_logout -rw-r--r-- 1 mc-sim mc-sim 3116 Oct 1 17:42 .bashrc -rw-r--r-- 1 mc- sim mc-sim 675 Oct 1 17:42 .profile test123@user-add-server:/home/mc-sim$ rm /home/mc-sim/.bash_logout rm: delete write-protected regular file `/home/mc -sim/.bash_logout"? y rm: unable to delete `/home/mc-sim/.bash_logout": Permission denied test123@user-add-server:/home/mc-sim$ rm /home/test/.bashrc test123@user-add-server:/home/mc-sim$

In the above example we delete user and group test, created earlier. In this case, the directory of this user remained untouched. As can be seen from the listing, the rights of the directory remained for id 1001. Next we create a new user and group, but with a different name - test123. This user is assigned UID And GID- a previously existing user test. Looking at the list of directories starting with /home/test*with key -n and without it, we see what happened - the user directory test became owned by the user test123 what access rights tell us -rw-r--r-- test123 test123. Login as user test123 and to check access rights in the directory /home/test We try to delete the file, and we also try to delete the file from the directory of the third user - mc-sim. This example illustrates well that in Linux everything is tied to identifiers.

Managing user and group databases in Linux

The main files containing information about users and groups are four files in the directory /etc.

/etc/passwd

password file containing basic information about users

/etc/shadow

shadow encrypted password file containing encrypted passwords

/etc/group

groups file containing basic information about groups and users belonging to these groups

/etc/gshadow

shadow groups file containing encrypted group passwords

It is highly not recommended to edit these files with a regular text editor. They (files) are updated when the above commands are executed, and when changed, they are blocked and synchronized.

If there is still an urgent need to edit the specified files, then using the command vipw you can safely edit the file /etc/passwd, and using the vigr command it is safe to edit the file /etc/group. These commands will lock the necessary files while changes are made using the help. If you make changes to the file /etc/passwd, team vipw will prompt you to check whether the file also needs to be updated /etc/shadow. Similarly, if you update a file /etc/group using the vigr command, you will receive a prompt that you need to update the file /etc/gshadow. If you need to remove group admins, you must use the command vigr, since the command gpasswd only allows you to add administrators.

Please note that in modern systems, passwd and group files do not store passwords in clear text. This is done for security reasons. Sami passwd and group files should be readable by everyone, and encrypted passwords should not be readable by everyone. That's why encrypted passwords are stored in shadow files, and these files are only readable by the root user. The necessary access to change authentication data is provided by a suid program, which has root privileges but can be run by any user.

File /etc/passwd

user-add-server:~# cat /etc/passwd root:x:0:0:root:/root:/bin/bash lp:x:7:7:lp:/var/spool/lpd:/bin/ sh sshd:x:101:65534::/var/run/sshd:/usr/sbin/nologin test123:x:1001:1001:Test Test:/home/test123:/bin/sh

The /etc/passwd file contains one line for each user on the system. Each line contains seven fields separated by colons (:), a description of the fields using the root user as an example:

field meaning description
Username root name used to login (login)
Password x user password (if encrypted, use - x)
user id (UID) 0 User ID
group id (GID) 0 Group ID

The basis for the distribution of access rights in the operating room Linux system lies on the concept of the user. The user who owns the file is given certain permissions to work with it, namely to read, write and execute. Read, write, and execute permissions are also set separately for all other users. Since everything in Linux is a file, such a system allows you to regulate access to any action in this operating system by setting file access rights. But even when creating Linux, the developers realized that this was clearly not enough.

That's why user groups were invented. Users can unite into groups in order to grant the groups the necessary permissions to access certain files, and, accordingly, actions. In this article we will look at user groups in Linux, look at why they are needed, how to add a user to a group and manage groups.

As I already said, groups in Linux appeared at the very beginning of the development of this operating system. They were designed to enhance rights management capabilities. Let's look at a small example, let's take an organization in which there is only one computer, we have administrators and users. Each person has their own account on our computer. Administrators can customize the system, but it’s better not to give free rein to users so as not to break something. Therefore, administrators are united in the admin group, and it is given access to all equipment, in fact, to all files in the dev directory, and users are united in the users group, and this group is given the ability to read and write files to a common directory, with the help of which they can share the results of your work. We could assign rights for each user separately, allowing him access to a particular file, but this is too inconvenient. That's why groups were invented. You say, it’s okay, can I appoint you? Well, now imagine that our users are processes. This is where the beauty of groups comes to the fore; groups are used not so much to provide access for users, but to manage program rights, especially their access to hardware. Separate groups are created for services and the user on whose behalf it is launched; a service can be a member of several groups, which provides it with access to certain resources.

Now let's look at how to view Linux groups.

Groups in Linux

All groups created on the system are located in the /etc/group file. By looking at the contents of this file, you can find out the list of Linux groups that are already on your system. And you will be surprised.

In addition to the standard root and users, there are a couple of dozen more groups here. These are groups created by programs to control those programs' access to shared resources. Each group allows reading or writing a specific file or directory on the system, thereby regulating the permissions of the user, and therefore the process running as that user. Here we can consider that a user is the same as a process, because the process has all the rights of the user from which it is launched.

Let's take a closer look at each of the groups to better understand why they are needed:

  • daemon- services that need the ability to write files to disk are launched on behalf of this group and the daemon user.
  • sys- the group provides access to kernel sources and include files saved in the system
  • sync- allows you to execute the /bin/sync command
  • games- Allows games to write their settings files and history to a specific folder
  • man- allows you to add pages to the /var/cache/man directory
  • lp- allows the use of parallel port devices
  • mail- allows you to write data to mailboxes /var/mail/
  • proxy- used by proxy servers, no access to write files to disk
  • www-data- the web server starts with this group, it gives access to the /var/www entry, where the web document files are located
  • list- allows you to view messages in /var/mail
  • nogroup- used for processes that cannot create files on the hard drive, but only read them, usually used in conjunction with the nobody user.
  • adm- allows you to read logs from the /var/log directory
  • tty- all devices /dev/vca allow read and write access to users from this group
  • disk- opens access to hard drives/dev/sd* /dev/hd*, we can say that this is an analogue of root access.
  • dialout- full access to the serial port
  • cdrom- access to CD-ROM
  • wheel- allows you to run the sudo utility to escalate privileges
  • audio- audio driver management
  • src- full access to the sources in the /usr/src/ directory
  • shadow- allows reading the /etc/shadow file
  • utmp- allows writing to files /var/log/utmp /var/log/wtmp
  • video- allows you to work with the video driver
  • plugdev- allows you to mount external devices USB, CD, etc
  • staff- allows writing to the /usr/local folder

Now that you know why you use groups in Linux and what they are by default, let's look at managing LInux groups.

Linux Group Management

You can also manage groups using the graphical interface. KDE has a program called Kuser specifically designed for this, and in Gnome it is done using the system settings. In addition, popular distributions have separate tools, such as YaST in OpenSUSE or Ubuntu Settings. But I think you'll figure it out with the graphical interface. And we will look at managing Linux groups through the terminal. First, let's deal with the files, and only then with the users.

When a file is created, it is assigned the primary group of the user who created it. It's just like this:

Here you can see that the owner of all folders is sergiy and the group is also sergiy. Correct, since these users were created by me. But let's go further:

Here we see that the sd* disk devices are assigned to the disk group, which all means that a user belonging to this group can access them. Or another example:

Everything is as we discussed in the previous paragraph. But these groups can not only be set by the system, but you yourself can manually change file groups; for this there is the chgrp command:

chgrp group_name file_name

For example, let's create a file test:

And let's change the group for it:

If you want to create a linux group, you can do this with the newgrp command:

sudo groupadd test

The situation with users is a little more complicated. The user has a main group, which is specified during creation, as well as several additional ones. The main group differs from the usual ones in that all files in the user's home directory have this group, and when it is changed, the group of these directories will also change. Also, all files created by the user receive this group. Additional groups are needed so that we can allow users to access different resources by adding them to these groups in Linux.

Managing Linux groups for a user is done using the usermod command. Let's look at its syntax and options:

$usermod options Username

  • -G- additional groups to which you need to add the user
  • -g change primary group for user
  • -R remove a user from a group.

You can add a user to a group using the usermod command:

sudo usermod -G -a group_name username

You can add a user to the linux group temporarily using the newgrp command. A new shell will open, and in it the user will have the necessary permissions, but after closing everything will return as it was:

sudo newgrp group_name

As an example, let's add our user to the disk group so that we can directly access the hard drives without the sudo command:

sudo usermod -G -a disk sergiy

Now you can mount disks without the sudo command:

mount /dev/sda1 /mnt

You can view the linux groups in which the user is a member with the command:

You can also use the id command. In the first case, we simply see a list of Linux groups; in the second, the group and user id are additionally indicated. To include a user in Linux group, the -g option is used for the main group.

Including the Linux OS, with all its numerous shells. This article will help anyone interested in understanding how to add a user to a Linux group, as well as create, edit and delete them. Go!

Groups and users are configured in console mode

Let's start by analyzing the creation procedure. Like everything else, this operation is performed using a special command, which in our case has the following syntax:

Please note that to make such changes to the system, you need root rights. If you don't have them, add "sudo" to the beginning of every command you enter to ensure they run successfully.

This creates a new account. In order for creation to take place with special settings, you can recycle certain keys; you can see their list below:

If creation with parameters failed, try the following:

The specified line will allow you to view all settings.

The following line will allow you to change these parameters:

To change information and parameters, use the usermod utility. The command will have the following syntax:

You can set or change the password as follows. Enter:

After this, you will need to write the desired password or, if it has already been set, enter the old one, and then the new one.

You also have the option to set a blank password. In this case, the command will look like:

From a security point of view, you should not create a “user” without the appropriate password. However, this is only relevant for administrators of firms and companies. This is not necessary for home use.

To delete use userdel. The syntax in our case will look like:

You can also create groups to which accounts will later be moved. To do this, write:

As in previous cases, you can use special keys to set additional parameters:

Now let's look at how to add the created “user” to the created group. To do this, you need to write the following line:

sudo usermod -aG testgroup vasyapupkin

For those who use not “naked” Linux, but its most popular shell - Ubuntu, we will look at working with accounts through a graphical interface. Initially, Ubuntu does not have the necessary utility to work with them, and all operations are carried out through the command line. However, you can install the necessary utility by typing:

sudo apt-get install gnome-system-tools

Once the installation is complete, you can easily perform the same operations as through the command line. Just go to “Properties”, and there you can add, change and delete them at your discretion.

You can view a list of all created users along with information about them in a special system file - /etc/passwd.

Now you know how to work with users and groups in the Linux operating system. Leave your feedback on this article and ask your questions in the comments.

Let's create the user vivek and add him to the developers group. Login as root user:

For example, let's add a user vivek:

useradd -g users -G admins,ftp,www,developers -s/bin/bash -pxxxx-d/home/ghost -m vivek

  • -d home directory
  • -s set the starting shell (/bin/sh) - you can then change it in the file /etc/passwd
  • -p password
  • -g primary group to which the user is assigned (The group must exist)
  • -G other groups to which the user is assigned
  • -m create a home directory for the user
  • xxxx character user password

Let's make sure that the developers group exists:

# grep developers /etc/group

If there is no group, use the command groupadd for creating new group developers:

Now using the command usermod add the user vivek to the developers group:

# adduser vivek developers && newgrp developers

Let's make sure that the user is added to the developers group:

#id vivek
Output:
uid=1122(vivek) gid=1125(vivek) groups=1125(vivek),1124(developers)

Set/change the password for the vivek user:

Let's play with groups

Let's tell the user vivek to participate only in the developers group

usermod-G developers vivek

Let's tell the user vivek to participate only in the admins, ftp, www, developers groups by entering:

# usermod -G admins,ftp,www,developers vivek

Let's remove the user vivek from some groups (reassign the groups to him):

# usermod -G ftp,www vivek

now vivek is not included in the admins and developers groups.

Note: team usermod will not change the username if that user is currently logged in to the system.

userdel— delete user

For example, delete the user vivek:

  • -r delete the user along with the home directory

Detailed SYNTAX

useradd [-u identifier[-o] [-i]] [-g group] [-G group[[,group] . . .]] [-d catalog] [-s shell] [-c a comment] [-m [-k skel_dir]] [-f inactive] [-e expire] [-p passgen] [-a event[, . . .]] reg_name

Detailed description

Call useradd usually adds a new user entry to the system data files identification and identity verification(Identification and Authentication - I&A). The exception is users network information service(Network Information Service or NIS for short). It also allows you to specify membership in additional groups for the user (option -G) and create an initial directory for it (option -m). The new login is blocked until the command is executed passwd.

Immediately after installation, the standard values ​​for various parameters are indicated in the file /etc/default/useradd. The default values ​​for those options listed below that require default values ​​can be changed using the command defadm.

System file entries created with this command have a length limit of 512 characters per line. If multiple options are given long arguments, this limitation may be violated.

The following options are supported:

-u identifier User identification number (UID). This number must be a non-negative integer not greater than MAXUID, defined in sys/param.h. The default is the next available (unique) non-legacy UID greater than 99. This option is ignored if the new login will be administered by Network Information Service (NIS). For more information about this, see the "Network Information Service Registration Names" section below.
-o This option allows you to duplicate the UID (make it non-unique). Since the protection of the system as a whole, as well as the integrity audit trail(audit trail) and accounting information(accounting information) in particular depends on the unique correspondence of each UID to a specific person, using this option is not recommended (to ensure that user actions are accounted for).
-i Allows the use of a legacy UID.
-g group The integer identifier or symbolic name of an existing group. This option specifies core group(primary group) for a new user. By default, the standard group specified in the file is used /etc/default/useradd
-G group[[,group] . . .] One or more elements in a comma-separated list, each of which represents an integer identifier or symbolic name of an existing group. This list defines membership in additional groups(supplementary group membership) for the user. Repetitions are ignored. The number of elements in the list should not exceed NGROUPS_MAX- 1, since the total number of additional groups for a user plus the main group should not exceed NGROUPS_MAX. This option is ignored if the new login will be administered by Network Information Service (NIS). See "Network Information Service Registration Names" below.
-d directory Start directory(home directory) of the new user. The length of this field must not exceed 256 characters. Default is HOMEDIR/reg_name, Where HOMEDIR- the base directory for the initial directories of new users, and reg_name- registration name of the new user.
-s shell The full path to the program used as the initial shell for the user immediately after registration. The length of this field must not exceed 256 characters. By default this field is empty, which forces the system to use the standard command interpreter /usr/bin/sh. As a value shell an existing executable file must be specified.
-c comment Any text string. Usually this short description registration name and is now used to indicate the last name and first name of the real user. This information is stored in the user record in a file /etc/passwd. The length of this field must not exceed 128 characters.
-m Creates a new user's home directory if it does not already exist. If the directory already exists, the user being added must have permission to access the specified directory.
-k skel_dir Copies the contents of a directory skel_dir to the new user's home directory, instead of the contents of the standard "skeleton" directory, /etc/skel. Catalog skel_dir must exist. The standard "skeleton" directory contains standard files that define the user's work environment. Administrator-specified directory skel_dir may contain similar files and directories created for a specific purpose.
-f inactive The maximum number of days allowed between uses of a registration name before the name has already been declared invalid. Typically the values ​​are positive integers.
-e expire The date from which the registration name can no longer be used; After this date, no user will be able to access under this login name. (This option is useful when creating temporary logins.) Enter an argument value expire(representing a date) can be in any format (except Julian date). For example, you could enter 10/6/99 or October 6, 1999.
-p passgen Indicates that the FLAG field in the file /etc/shadow must be set to the specified value. This field is accessed by the command passwd to determine whether the password generator is valid for a given user. If option -p not explicitly specified, entry is checked FORCED_PASS in file /etc/default/useradd to determine the value for the corresponding field in /etc/shadow. If records FORCED_PASS no in /etc/default/useradd, in the corresponding field of the entry in /etc/shadow it won't matter. If the value FORCED_PASS equals 1, entry in /etc/shadow gets the value 1. If the value passgen is not empty and is not a printable ASCII character, a diagnostic message is issued.
-a event List of event types or classes, separated by commas, forming audit mask(audit mask) for the user. Immediately after installing the system, there is no standard audit mask for the user, but it can be set in the file /etc/default/useradd using the command defadm. This option can only be used if Auditing Utilities are installed. (To find out what packages are installed on the system, run the command pkginfo.)
reg_name A printable string that specifies the login name for the new user. It should not contain colons ( : ) and line feed characters ( \n). It also shouldn't start with a capital letter.

Note that many of the default values ​​for the parameters discussed above can be changed using the command defadm, designed to work with a file /etc/default/useradd. These default values ​​apply only to local users. For NIS users, default values ​​are set in the Network Information Service database. To change NIS defaults, you must specify options on the command line.

Network Information Service Registration Names

If the login name begins with the character + , (For example, +chris), the user definition will be managed by the Network Information Service (NIS). Default values ​​will be determined based on the NIS database rather than the file /etc/defaults/useradd. Argument values ​​for options -u, -g And -G will be silently ignored if these options are specified. Instead, the user ID and group ID values ​​will be taken from the NIS database. See the help page for details. passwd. Please note that when adding a NIS user, the login must already exist in the NIS database. For example, to add a login name Chris as NIS username, Chris must already exist in the NIS database. Then you need to call useradd with registration name +chris to indicate that a user needs to be added Chris as a NIS user, not as a local user.

FILES

/etc/default/useradd
/etc/group
/etc/passwd
/etc/security/ia/ageduid
/etc/security/ia/audit(if Auditing Utilties are installed)
/etc/security/ia/index
/etc/security/ia/master
/etc/shadow
/etc/skel

DIAGNOSTICS

Team useradd exits with return code 0 if successful. If errors occur, the following messages may be displayed:


Invalid command line syntax.
The command line syntax was invalid.
An invalid argument was specified in the option.
An invalid argument was provided with an option.
The identifier specified in the -u option is already in use, but the -o option is not specified.
The uid specified with the -u option is already in use and the -o option was not specified.
The group specified with the -g option does not exist.
The group specified with the -g option does not exist.
The login name provided is not unique.
The specified login is not unique.
Failed to change /etc/group. The login is added to the /etc/passwd file, but not to the /etc/group file.
Cannot update /etc/group. The login was added to the /etc/passwd file but not to the /etc/group file.
The starting directory could not be created (with the -m option) or copying skel_dir to the starting directory failed.
Unable to create the home directory (with the -m option) or unable to complete the copy of skel_dir to the home directory.
The ID is not old enough. Choose another.
uid not aged sufficiently. Choose another.
An invalid -a option was specified; system service is not installed.
An invalid option -a was specified; system service not installed.
The specified audit event type or class is invalid.
An invalid audit event type or class event was specified.

There are times when it becomes necessary to find out which users are registered in the Linux operating system. This may be necessary to determine whether there are redundant users, whether a specific user needs it, or whether whole group of which in changing personal data.

People who constantly use this system, can do this using a number of methods, but for beginners this is very problematic. Therefore, the instructions that will be described below will help an inexperienced user cope with the task. This can be done using the built-in terminal or a number of programs with a graphical interface.

Method 1: Programs

In Linux/Ubuntu, you can manage users registered in the system using parameters, the operation of which is provided by a special program.

Unfortunately, the programs for the graphical desktop shell Gnome and Unity are different. However, they are both capable of providing a set of options and tools for checking and editing user groups in Linux distributions.

Accounts in Gnome

First you should open system settings and select the section called "Accounts". Please note that system users will no longer be displayed here. The list of registered users is in the panel on the left; to the right there is a section for settings and changing the data of each of them.

The Users and Groups program in a distribution with the Gnome graphical shell is always installed by default, but if you do not find it on the system, you can automatically download and install it by running the command in "Terminal":

sudo apt-get install unity-control-center

KUser in KDE

There is one utility for the KDE platform, which is even much more convenient to use. It's called KUser.

The program interface displays all registered users, and if necessary, you can also see system users. This program can change user passwords, move them from one group to another, delete them if necessary, and the like.

As with Gnome, KDE comes with KUser installed by default, but can be uninstalled. To install the application, run the command in "Terminal":

sudo apt-get install kuser

Method 2: Terminal

This method is universal for most distributions developed based on the Linux operating system. The point is that she has it in her software a special file containing information regarding each user. This document is located at:

All entries in it are presented in the following form:

  • the name of each user;
  • unique identification number;
  • ID password;
  • Group ID;
  • group name;
  • home directory wrapper;
  • home directory number.

To increase security, each user's password is stored in the document, but it is not displayed. In other modifications of this operating system, passwords are even stored in separate documents.

Full list of users

You can redirect to a file with saved user data using "Terminal" by entering the following command into it:

If the user ID has less than four digits, then this is system data, which is highly undesirable to make changes to. The fact is that they are created by the OS itself during the installation process to ensure the most secure operation of most services.

Names in the user list

It is worth noting that in this file there may be quite a lot of data that you are not interested in. If you only need to know the names and basic information about users, you can filter the data in the document by entering the following command:

sed "s/:.*//" /etc/passwd

View active users

In a Linux-based OS, you can see not only the users who have been registered, but also those who are currently active in the OS, and at the same time see what processes they are using. For such an operation, a special utility is used, called with the command:

This utility will issue all commands that are executed by users. If he simultaneously uses two or more commands, they will also be displayed in the output list.

Browsing history

If necessary, it is possible to analyze user activity: find out the date of their last login. It can be used based on the log /var/wtmp. It is called by entering the following command on the command line:

Last activity date

In addition, in the Linux operating system, you can find out when each of the registered users was last active - this is done by the command lastlog, executed using the request of the same name:

This log also displays information about users who have never been active.

Conclusion

As you can see, in "Terminal" provides more detailed information regarding each user. It allows you to find out who logged into the system and when, determine whether unauthorized people were using it, and much more. However, for the average user there will be the best option use a program with a graphical interface so as not to delve into the essence of Linux commands.

It’s quite easy to view the list of users; the main thing is to understand on what basis this operating system function works and for what purposes it is used.

Similar articles

2024 my-cross.ru. Cats and dogs. Small animals. Health. Medicine.