Two files closely related to Linux passwords

Source: Internet
Author: User

One: About/etc/passwd:

On the content understanding of/etc/passwd

In/etc/passwd, each line represents a user's information; There are 7 fields in a row; Each section is divided by: number, for example, the following are two lines of/etc/passwd in my system;

Beinan:x:500:500:beinan Sun:/home/beinan:/bin/bash

Linuxsir:x:505:502:linuxsir Open,linuxsir Office,13898667715:/home/linuxsir:/bin/bash

Beinan:x:500:500:beinan Sun:/home/beinan:/bin/bash

Linuxsir:x:501:502::/home/linuxsir:/bin/bash

First field: Username (also known as login); In the example above, we see that the user names of these two users are Beinan and Linuxsir respectively;

second field: password; In the example we see an X, in fact the password has been mapped to the/etc/shadow file;

Third field: UID; see the explanation of the UID in this article;

Fourth field: GID; see the explanation of the GID in this article;

Fifth field: Username full name, this is optional, can not set, in Beinan this user, the user's full name is Beinan Sun, and Linuxsir This user is not set the full name;

Sixth field: The location of the user's home directory; Beinan This user is/home/beinan, and Linuxsir this user is/home/linuxsir;

Seventh field: The type of shell used by the user, Beinan and Linuxsir are all in bash, so set to/bin/bash;

The understanding of UID:

UID is the user's ID value, the value of each user's UID is unique in the system, and more specifically, each user should correspond to a unique UID, which the system administrator should ensure. The system user's UID value starts from 0, is a positive integer, as far as the maximum value can be found in the/etc/login.defs, the general Linux distribution contract is 60000; in Linux, the root uid is 0, with the highest system privileges;

UID in the system unique characteristics, as a system administrator should ensure that the standard, UID uniqueness of the system is related to security, should be worthy of our attention! For example, when I change the UID of Beinan to 0 in/etc/passwd, what do you suppose will happen? Beinan This user will be identified as the root user. Beinan This account can be used for all root operations;

UID is an identity that confirms user rights. The user login system is in the role of the UID to achieve, not the user name, remember; it is dangerous to share a UID with several users, as we mentioned above, to change the UID of the average user to 0, and root to share a UID, This, in effect, creates confusion over the system's administrative authority. If we want to use root permissions, we can do it through Su or sudo, and we must not let a user and root share the same UID;

UID is unique, just ask admin to do, in fact we modify/etc/passwd file, can modify any user's UID value is 0,

In general, each Linux distribution will reserve a certain UID and GID to the system virtual users Occupy, virtual users are generally installed in the system, is to complete the system tasks required users, but virtual users can not log on to the system, such as FTP, nobody, ADM, RPM, Bin, shutdown, etc.;

In the Fedora system, the first 499 UID and GID are reserved, the UID from 500 begins when we add new users, and the GID begins at 500, and in other systems, some systems may reserve the first 999UID and GID;/etc/in each system The minimum value of the uid_min in the login.defs is quasi; the uid_min of the Fedora system Login.defs is 500, and the Uid_max value is 60000. That is, the value of the user's UID that we added by default is between 500 and 60000, while Slackware adds the user by AddUser not specifying a UID, which is the default UID starting from 1000; adduser

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.