First, set the user to which the file belongs and the group to which it belongs (CHOWN,CHGRP)
CHGRP is used to change the group owner of a file in the general format:
CHGRP [option] group file
(1) Change the group owner of the file test to ZFS:
CHGRP ZFS Test
(2) Change the group owner of all files under test and its subdirectories to ZFS:
Chgrp-r ZFS test
Chown is used to change the file owner and group owner in the general format:
chown [option] owner[:group] File
(1) Change the owner of all files under test and its subdirectories to ZFS:
Chown ZFS Test
(2) Change the owner of the test file to ZFS and the group owner to root:
Chown zfs:root Test
Second, give the file the appropriate permission bit (chmod)
The chmod command format is:
chmod [option] mode files ...
Mode indicates the format:
1, Digital way: [N][n][n] r=4 w=2 x=1
rwx:4+2+1; r-x:4+1; Rw-:4+2
2. Text mode: [ugoa][+-=][rwx]
U – Owner of the file;
G-Persons belonging to the same group (group) as the owner of the file;
O-persons other than others;
+--Increase permissions
---Remove permissions
=--Set permissions
Give Rwxr-xr-x permission to the test file:
chmod 755 Test
Give rwxr-xr-x permissions to all files under test and its subdirectories:
Chmod-r 755 Test
Add permissions to a file by using the second method
Add RW permissions to the group owner of the file ABC
chmod G+RW ABC
Remove x permission for the user owner of the ABC file
chmod u-x ABC
Specify other user rights for file ABC to rw-
chmod o=rw-
Increase x permissions for all users of all files under file ABC and its subdirectories
Chmod-r a+x ABC
Sticky bit (sbit)
The role of the Sbit directory is: "In a directory with bit, if the user has W and x permissions in the directory, then when the user establishes a file or directory in that directory, only the file owner and Root have the right to delete."
4 for Suid
2 for Sgid
1 for Sticy Bit
#chmod 4777 Test
#chmod 2777 Test
#chmod 1777 Test