linux-user and user group base commands and actions
Adding users and user groups
Add User: Useradd admin Add user called admin
Add Group: Groupadd Admin Add user group
Delete User: Userdel admin Delete User
2. Viewing users and user groups
View User cat/etc/passwd
View Group Cat/etc/group
3. Modify user and user group properties
Modify User: Usermod
-U modifies UID information for the user
-G Modify User group information
User Group Management Groupadd
-G Custom Group ID
-R Add System group
Groupmod
-G Modify the group ID information
-N Fix the name of the group
Rights Management:
Chown: Change the owner of the file (only the administrator can fix it)
-R Modify the owner of the directory and internal files
Example: Chown admin /home/admins
CHGRP: The group to which the file is repaired (only Administrator-modified)
-R Recursive modification
Example: Chgrp admin/home/admins
To modify a file's permissions:
chmod permissions to modify files
-R Recursive modification
Example: chmod 777/home/admins
Add Special permissions: chmod
setuid: Sets the permission to have the file owner in the execution phase of the file. The typical file is/usr/bin/passwd. If the file is executed by an average user, the file can be rooted during execution so that the user's password can be changed.
setgid: This permission is valid only for the directory. After the directory is set, any user who creates the file in this directory has the same group as the group to which the directory belongs.
chmod g+s /home/admins to add markup to the directory
chmod u+s /home/admins to add markup to a file
This article is from the Computer knowledge blog, so be sure to keep this source http://huagongxiaodi.blog.51cto.com/10605602/1789739
linux-user and user group base commands and actions