Group management and rights management in Linux (emphasis, difficulty)

1. View the file owner: ls -ahl Instance
: create group groupone; create user user; put user in groupone group; then user creates file test.txt;
write picture description here
write picture description here
The owner of the file is changed to yongyu2, but the group remains unchanged
Command chown username file name
write picture description here
2. group

instruction significance
groupadd group name Create group
useradd -g 组名 user Add the newly added user user to the "group name" group
ls -ahl Query group owner
chgrp groupname filename Modify the file to the "group name" group

Example: Modify the test.txt group to the groupone group
write picture description here
3. Change the user group:

When adding a user, you can specify which group the user is added to, and also use the root administrator authority to change the group a user belongs to.

Change user group significance
usermod -g group name username Change user group
usermod -d directory name username Change the initial directory where the user logs in

Example:
write picture description here
4. Overview of linux operating system:
write picture description here

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324735958&siteId=291194637