Linux accounts and user groups

Source: Internet
Author: User

1. Users and Groups
When you log in to Linux, you need to enter your user account. Linux only recognize user ID, user ID, username, uid user belongs to the user group, group ID, referred to as GID.
2. User account
User accounts are related to two files under Linux:/etc/passwd and/etc/shadow./etc/passwd Save user account information. /etc/shadow is a special management of password-related data.
/etc/passwd file
$ head-4/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/nologin
Each row represents an account, in which some accounts are required for system operation, referred to as the system account, such as bin, Daemon, ADM, nobody and so on.
Use: Delimited, total 7 fields: 1: Account name 2: Password early save password, password data is now saved to/etc/shadow, so now is x instead. 3:uid 0: For system administrator, 1-499: System account, 500-65535: General user account. 4:gid Group ID5: User Information Description column 6: After the home folder user logs on, the default user home directory for the user's home directory is/home/yourid name7:shell the user is logged in to the shell that was taken.
/etc/shadown file
$ head-4/etc/shadowroot:$1$l0afe9hs$d1/fimqil3foyul3etyk10:16353:0:99999:7:::bin:*:13361:0:99999:7:::d aemon:* : 13361:0:99999:7:::adm:*:13361:0:99999:7:::
View permissions, generally set to root read-only
Ll/etc/shadow-r--------  1 root root 1085 Nov 03:40/etc/shadow

By: Delimited, total 9 fields 1: Account Name 2: Password encrypted password field. 3: The date of the most recent password change is 1970-01-01 cumulative days. 4: The number of days that the password cannot be changed 0 means no Limit 5: The number of days that the password needs to be re-modified 99999 is calculated as 273 years, 6: The password needs to change the warning days before the expiration date 7: Password expires after the account Grace time can also log in, after login force change Password 8: Account expiration Date will not be Re-use 9: Reserved fields
3. User groups
User group data is saved in the/etc/group file
$ head-4 Grouproot:x:0:rootbin:x:1:root,bin,daemondaemon:x:2:root,bin,daemonsys:x:3:root,bin,adm
A row represents a user group, with a total of 4 columns of files separated by:
1: User group Name 2: User group password usually does not need to be set, password file is/etc/gshadow 3:gid4: User group supported by user.
Initial user Group initial group: GID in/etc/passwd for user Initial user group active user Group One user can have multiple groups, the group currently in use is a valid user group
$ Groupsroot Bin Daemon
Use the Groups command to view the group of users, the first one that appears as a valid user group.
You can switch groups using NEWGRP groupname.

/etc/gshadow Group Password file
Head-4/etc/gshadow   Root:::rootbin:::root,bin,daemondaemon:::root,bin,daemonsys:::root,bin,adm
Use: Delimited, 4 column 1: Group name 2: Password 3: User Group Admin account 4: User group's user account.

Address: http://blog.csdn.net/yonggang7/article/details/42192261

Linux accounts and user groups

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.