1, chgrp (change file to belong to user group)
CHGRP user Group filename # # #就是这个格了. If the entire directory is changed, the plus-r parameter is used for recursion.
such as: Chgrp-r user smb.conf
The CHGRP command changes the file or directory-owning group, such as the simplest:
View now the AA file belongs to the clip group:
[Root@clip clip]# ls-l AA
-rwxrwxr-x 1 Clip clip 1260 APR 14:05 AA
Want to change to Delijia
[Root@clip clip] #chgrp Delijia AA
[Root@clip clip]# ls-l AA
-rwxrwxr-x 1 Clip Delijia 1260 APR 14:05 AA
It's been successfully changed.
2. Chown (change file owner)
Format: A:chown user name File/directory
B:chown Username: User group: File/Directory
If the entire directory is changed, the plus-r parameter is used for recursion.
Example: Chown-r root/etc/config.cfg
3, chmod (change file properties)
There are two ways to set up a file property, which are numbers and symbols, respectively.
Mode: Permission set string, the format is as follows: [Ugoa ...] [[+-=][RWXX] ...] [,...] where u represents the owner of the file, G means that the owner of the file belongs to the same group (group), o means other people, and a says all three are.
+ means to increase permissions,-to indicate cancellation rights, = to represent a unique set of permissions.
R means readable, W is writable, X is executable, x means only if the file is a subdirectory or the file has been set to executable.
-S: The owner or group ID of the process is placed as the file owner of the file when the file is executed.
-C: Display the change action if the file permissions have actually changed
-F: Do not display error messages if the file permissions cannot be changed
-V: Show details of permission changes
-r: The same permission changes are made to all files under the current directory and subdirectories (that is, to be changed one at a time)
--HELP: Show Auxiliary Instructions
--version: Display version
Example : Set the file file1.txt to be readable by all people:
chmod ugo+r File1.txt
Set the file file1.txt to be readable by all people:
chmod a+r File1.txt
The file file1.txt and File2.txt are set to the owner of the file and are writable by the same group as which they belong, but others are not writable:
chmod ug+w,o-w file1.txt File2.txt
Set ex1.py as only the owner of the file can perform:
chmod u+x ex1.py
All files and subdirectories under the current directory are set to anyone can read:
Chmod-r A+r *
When another user executes Oracle's sqlplus this program, his identity becomes Oracle for the time being.
chmod u+s Sqlplus
In addition, chmod can also use numbers to represent permissions such as chmod 777 file
Syntax is: chmod ABC file
Each of these a,b,c is a number, representing the permissions of user, Group, and other respectively.
To rwx the property is 4+2+1=7;
To rw-the property is 4+2=6;
To r-x the property is 4+1=5.
chmod a=rwx File
chmod 777 File
chmod ug=rwx,o=x File
chmod 771 File
If you use chmod 4755 filename, you can make this program have root permissions
If the administrator is often said root user, basically have the right to see all the files