Linux/etc/passwd,/etc/shadow,/etc/group files

Source: Internet
Author: User

1./etc/passwd

[Email protected] ~]# Cat/etc/passwdroot:x:0:0:root:/root:/bin/bashbin:x:1:1:bin:/bin:/sbin/nologindaemon:x:2:2: Daemon:/sbin:/sbin/nologinadm:x:3:4:adm:/var/adm:/sbin/nologinlp:x:4:7:lp:/var/spool/lpd:/sbin/nologinsync:x : 5:0:sync:/sbin:/bin/syncshutdown:x:6:0:shutdown:/sbin:/sbin/shutdown .....

Each field is separated by: and the fields contain the following information:

① login user name;

② user password;

③ UID of user account (in digital form)

④ user account Group ID (GID) (in digital form)

⑤ text Description of user account (called Memo field)

⑥ the location of the user home directory

⑦ User's default shell

Usermod is a user account modification tool

-L Modify the login name of the user account

-L Lock account so users cannot log in

-P Modify Account password

-U unlocks so that the user can log on.

CHPASSWD read the login password pair from the file and update the password

Chage change the expiration date of a password

CHFN Modify user account comment information

Chsh Modifying the default login shell for a user account

2./etc/shadow

[Email protected] ~]# cat/etc/shadowroot:$6$lrtcgaos$v/ f8z.wko94leoxrxjv4qeqmm8y2yd9z6bba0u3vtefljbutfhjbwfqwkxxkqti2gpyxcdm04tubze4w5nmdo.:17206:0:99999:7:::bin:* : 15980:0:99999:7:::d aemon:*:15980:0:99999:7:::adm:*:15980:0:99999:7:::lp:*:15980:0:99999:7:::sync:* : 15980:0:99999:7:::shutdown:*:15980:0:99999:7:::halt:*:15980:0:99999:7::: .....

As with/etc/passwd, each field of the/etc/shadow is also separated by: each field information is as follows

① the login name corresponding to the login field in the/etc/passwd file

② Password after encryption

③ the number of days since the password was last modified (calculated from January 1, 1970)

④ How many days before you change your password

⑤ How many days must you change your password

How many days before the ⑥ password expires remind the user to change their password

How many days after the ⑦ password expires disable the user account

⑧ the date the user account was disabled (expressed as the number of days from January 1, 1970 to the day)

⑨ reserved fields for future use

3./etc/group

[Email protected] ~]# Cat/etc/grouproot:x:0:bin:x:1:bin,daemondaemon:x:2:bin,daemonsys:x:3:bin,admadm:x:4:adm, Daemontty:x:5:disk:x:6:lp:x:7:daemonmem:x:8: .....

The/etc/group file has 4 fields:

① Group Name

② Group Password

③gid

④ List of users belonging to this group

USERMOD-G Group name username #在组中添加用户, the-G option adds the new group to the group list for the user account

Groupmod-n New group name old group name #更改组名

Linux/etc/passwd,/etc/shadow,/etc/group files

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.