In Linux, there are usually three types of users: superuser, regularuser, and systemuser ). The UID and GID of the superuser are both 0. The UID of a regular user starts from 1000. The UID of the System user ranges from 1 to 499, and also includes 65,534. Ubuntu usually creates different gids for each UID larger than 1000. the system administrator can add other users to the same GID or create a new group.
There are usually three types of users in Linux: super user, regular user, and system user ). The UID and GID of the superuser are both 0. The UID of a regular user starts from 1000. The UID of the System user ranges from 1 to 499, and also includes 65,534. Ubuntu usually creates different gids for each UID larger than 1000. the system administrator can add other users to the same GID or create a new group, then add the user to the group.
Ubuntu uses the/etc/passw file to save the user account information in the system. All users have an entry in the passwd file, saving the user name, the encoded password, the user ID (UID) and the group ID (GID ). The last two items are the user's/home directory and the default shell (/bin/bash ).
No matter how many system administrators there are, there is only one super user account. A Super user Account usually refers to a root user who has full control over the system. The Super User is unique, and the UID and GID of the Super User are both 0. As follows:
Root: x: 0: 0: root:/bin/bash
By default, the Super User Account is disabled in Ubuntu, but the first user of the system obtains all permissions of the Super User through The sudo command. Therefore, the command prompt you usually see is ($). When you need to execute system management commands, you need to add sudo before the command, and then be prompted to enter the password. after entering the password, the Ubuntu system will execute this command, as if you are a Super User.
In other Linux systems, when you want to enter the Super User root, enter the command su-nd, and then enter the Super User Password to see the Super User command prompt (#). In Ubuntu, you can enter sudo-I, and then enter the password to see the Super User command prompt (#). After you execute the relevant command, enter exit, and press Enter, the system returns to the regular user prompt ($ ).
In Ubuntu, superuser accounts are disabled by default. However, you can enable the superuser account by entering sudo passwd on the terminal, and then entering the root user name and password as prompted. The root account is enabled. Super Users are not recommended to be enabled in Ubuntu because they often cause irreparable disasters when working with super user permissions.
Regular users refer to users who log on to the Linux system but do not execute management tasks, such as text processing or sending and receiving emails. Super Users can grant normal users the operation permission through the access permissions of files and directories. For example:
Cindy: x: 1000: 1000: cindy,:/home/cindy:/bin/bash
Here you can see that the location of the password is x, but this is not the real encoded password. All passwords are encoded and stored in the/etc/shadow file. In the previous content, we know that each file has three permissions: rwx (read/write execution). For each file or directory, permissions are assigned to three types of targets: users, groups, and others. There are three common commands for file permission management:
Chgrp -- change the group to which the file or directory belongs
Chown -- change the user to which the file or directory belongs
Chmod -- change the access permission of a file or directory
The system user is not a single user, also known as a logical user or pseudo user. The system user does not have the corresponding/home directory and password. A system account is usually used by a Linux system to manage daily services. For example, the System user www-data owns the Apache web server and its related files. Only system users www-data and super users have access to these files. In passwd, the System user is represented as follows:
Www-data: x: 33: 33: www-data:/var/www:/bin/sh