Linux Users
When you log in to a Linux system, you first identify yourself by signing in with a specific user name (username). Each process running on the system has an associated user name, and each file on the system is marked by a specific user. Each user on the system has a unique user name, which corresponds to an ID, called a user ID (userid), and is often abbreviated as UID. People like to think in words, and the Linux kernel uses numbers (user IDs) to be simpler, and the kernel operates on user IDs rather than usernames. The user ID is converted to the user name only when the output is displayed.
Storing the user's database
The system has a database to hold the user name and user ID of the corresponding relationship, this database is/etc/passwd. Most users of this database can read, but cannot modify.
| column number |
Description |
| 1 |
User name |
| 2 |
Password, storing the user encrypted password on the old Unix, for security reasons do not use this field now |
| 3 |
User ID (UID), the Linux kernel uses this integer to identify the user |
| 4 |
Primary group ID (GID), the Linux kernel uses this integer to identify the user's primary group. |
| 5 |
For storing simple text, such as the user's full name, phone number, etc. |
| 6 |
Home directory, when a user logs in, the shell that he logs into will use this directory as the current working directory, usually for the user's private |
| 7 |
Login shell, default is/bin/bash |
We seldom modify the user by modifying the file, which is usually modified by the command.
The database that holds the password
In the/etc/passwd, there is a variety of user information, but no password, the password is stored in the/etc/shadow file. The user is not allowed to view this configuration file because it holds the password.
Change Password
For ordinary users can change the password with passwd, for the administrator can use passwd username method to modify the password, that is, the administrator can modify any user's password.
Types of users
Linux users fall into three categories:
- Normal User
- Root user
- System users
Normal User
Ordinary users are the real users of the system, such as Old Mo's user is cclove. Ordinary users usually use /bin/bash as the login shell and the /home/user name as the home directory.
In general, ordinary users only have the right to create files in their own home directory and temporary directory, the average user ID number is usually greater than or equal to 1000.
Root user
Is the superuser, the value of UID is 0. The root user has full privileges on the system, can modify and delete any file, can run any command, can cancel any process. The root of the household directory is /root
System users
The Linux system retains the value of the low UID system user, the system user does not represent the person, but represents the system component. The process of handling e-mail, for example, is often run with user mail.
System users typically do not have a login shell (they cannot log on as a normal user) because they do not represent the actual logged-on user. The home directory of the system user is not in//, usually in the system directory belonging to the relevant application.
Example:
View process users, you can find root users, as well as ordinary users, and part of the system users are running processes (too large, no interception system users).
View the file owner (which user the file is). LS-L Displays details, displays the owner of the file as a user name, and Ls-ln is displayed numerically.
Linux Basics-8