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;
The owner of the file is changed to yongyu2, but the group remains unchanged
Command chown username file name
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
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:
4. Overview of linux operating system: