View users and groups
-
First of all, before the experience operation, let's take a look at the users and groups under the current system. Whoami View currently logged in users
-
The Passwd file stores all users of the current system, while the group file /etc/group records.
-
A user can belong to multiple groups, view the group to which the user belongs, gourps + username
END
Change linux file directory\file owner permissions
-
Change file owner (chown)
[root@linux ~]# chown account name file or directory, as shown in the figure, change the owner of the file fail2ban to nginx
-
Change the user group of a file with the command chgrp
[root@linux ~]# chgrp group name file or directory
-
You can also use the chown command
Modify user and group at the same time, chown owner, group file\directory name
-
Override directory permissions
After the directory permissions are modified, the default is to modify the permissions of the current level. If the subdirectories are also recursive, you need to add the R parameter
-
Chown -R : recursively, together with all files and directories in subdirectories