Users, Groups, permissions
Permissions: R, W, X
File:
- R: Readable, you can use similar commands such as cat to view the contents of the file;
- W: writable, can edit or delete this file;
- X: Executable, exacutable, can be at the command prompt as a command to submit to the kernel to run;
Directory:
- R: You can perform LS on this directory to list all internal files;
- W: Files can be created in this directory;
- X: You can switch to this directory using a CD, or you can use Ls-l to view the details of the internal files;
Rwx
- r--: Read-only
- R-x: Read and Execute
- ---: No permissions
- 0---: No permissions
- 1 001--x: Execution
- 2 010-w-: Write
- 3 011-wx: Write and Execute
- 4 r--: Read-only
- 5 101 R-x: Read and Execute
- 6 rw-: Read and Write
- 7 111 rwx: Read and write execution
User: UID,/etc/passwd
Group: GID,/etc/group
Shadow Password:
Users:/etc/shadow
Group:/etc/gshadow
User Category:
- Admin: 0
- Normal Users: 1-65535
- System users: 1-499
- General Users: 500-60000
User Group Category:
- Administrators group:
- Normal Group:
- System Group:
- General Group:
User Group Category:
- Private group: When a user is created, a group with the same name as the user name is automatically created if the group to which it belongs is not specified
- Basic group: Default group for users
- Additional groups, additional groups: groups other than the default group
/etc/passwd
- Account: Login Name
- Password: password
- Uid:
- GID: Basic Group ID
- Comment: Notes
- Home dir: Home directory
- Shell: User's default shell
/etc/shadow
- Account: Login Name
- Encrypted Password: encrypted password
Useradd USERNAME Groupadd GRPNAME
User management: Useradd, Userdel, Usermod, passwd, Chsh, CHFN, finger, id, chage
Group management: Groupadd, Groupdel, Groupmod, gpasswd
Rights Management: Chown, CHGRP, chmod, umask
/ETC/PASSWD: Username: Password: uid:gid: Comments: Home directory: Default Shell
/etc/group: Group name: Password: GID: List of users with this group attached to the group
/etc/shadow: User name: Password: The last time to change password: Minimum age: Maximum Age: Warning Time: Inactive time: Expiry time:
User management: Useradd, Userdel, Usermod, passwd, Chsh, CHFN, finger, id, chage
useradd [Options] USERNAME
- -U UID
- -G GID (Basic Group)
- -G GID,... (Additional groups)
- -C "COMMENT"
- -d/path/to/directory
- -S SHELL
- -m-k
- -M
- -r: Add System User/etc/login.defs
Userdel:userdel [option] USERNAME
-r: Delete User's home directory at the same time
ID: View user's account attribute information
Finger: View user account information finger USERNAME
Modify user account properties: Usermod
- -U UID
- -G GID
- -A
- -G GID: Does not use the-a option to overwrite previous additional groups;
- -C
- -d-m:
- -S
- -L
- -L: Lock account
- -U: Unlock Account
CHSH: Modifying the user's default shell
CHFN: Modifying annotation information
Password management: passwd [USERNAME]
- --stdin
- -L
- -U
- -D: Remove user password
PWCK: Checking user account Integrity
Group Management:
Create Group: Groupadd
Groupadd
- -G GID
- -R: Added as System group
Groupmod
Groupdel
GPASSWD: Setting a password for a group
Rights Management: R:w: x:
Three types of users: U: belong to the main G: Group O: Other users
Chown: Change file owner (only administrators can use this command)
# chown USERNAME File,...
- -R: Modify the owner of the directory and its internal files
- --reference=/path/to/somefile file,...
Chown username:grpname File,...
Chown USERNAME. GRPNAME file,...
# chgrp GRPNAME file,...-R
--reference=/path/to/somefile file,...
chmod: Modify permissions for a file
Modify permissions for three categories of users:
chmod MODE File,...
- -R
- --reference=/path/to/somefile file,...
To modify a user or some class of user rights: U,g,o,a
chmod user category =mode file,...
Modify some or some bit permissions for a certain class of users: U,g,o,a
chmod user category +|-mode file,...
User, group, and permission-related directives in Linux