Users, Groups, permissions
Permissions: R,w,x
File:
R: Readable, you can view the contents of the file using commands like Cat
W: writable, can edit or delete this file
X: Executable, exacutable, can command prompt to be submitted to the kernel to run
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
Users: UID,/ETC/PASSWD
Group: Gid,/etc/group
Shadow command:
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
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:
User name: Password: uid:gid: Comments: Home directory: Default Shell
/etc/shadow:
User name: Encrypted password: The last time the password was modified: Minimum Age: Maximum Age: Warning Time: Inactive time: Expiry time:
useradd [option] USERNAME
-U UID
-G GID (Basic Group)
-G GID,... (Additional groups)
-C "COMMENT" comment
-d/path/to/directory Home Directory
-S SHELL
-M automatically establishes the user's log in directory
-M do not automatically set up the user's log in directory
-R Add System user
To add a user's profile:/etc/login.defs
Security Shell:/etc/shells currently available on the system
Userdel [option] USERNAME
-R Delete the user's home directory at the same time
ID: View the user's home directory to delete users
-U Display user uid
-G Display user gid
-G Displays the ID of the additional group to which the user belongs
-N Displays the name of the group or additional group to which the user belongs
Finger: View user account information
Finger USERNAME
To modify user account properties:
Usermod
-U UID
-G GID
-a-g GID: Do not use the-a option to overwrite previous additional groups
-C Modify User account notes
-D Modify the directory in which users log on
-S modifies the shell used by the user when logged in
-L Modify User account name
-L LOCK the user password to invalidate the password
-U unlock password lock
CHSH: Modifying the user's default shell
CHFN: Modifying annotation information
Password Management:
passwd [USERNAME]
--stdin non-interactive encryption, example: Echo abc123 | passwd--stdin $USERNAME
-L Lock Password
-U Unlock Account
-D Delete User password
PWCK: Checking user account Integrity
Group Management:
To create a group:
Groupadd
-G GID
-R added as System group
Groupmod
-G GID
-N GRPNAME
Groupdel
GPASSWD: Setting a password for a group
Newgrp GRPNAME temporarily added to GRPNAME group, restart failure
This article is from the "Maskpaperman" blog, make sure to keep this source http://mrros.blog.51cto.com/9403540/1853692
"Self-learning Linux" Linux users, Groups, permissions (i)