Linux Command--chmod
Command Description
Permissions to change the file or directory. In the UNIX system family, the control of file or directory permissions is divided by reading, writing, executing 3 general permissions, and 3 special permissions available, and then with the owner and the group to manage the jurisdiction. You can use the CHMOD directive to change the permissions of files and directories by using either a literal or a digital code. The permissions for symbolic connections cannot be changed, and if you modify permissions on symbolic connections, their changes will affect the original file being connected. The notation for the scope of the permission is as follows:
U:user is the owner of a file or directory.
G:group is the group that the file or directory belongs to.
O:other, in addition to file or directory owners or groups, other users belong to this scope.
A:all, that is, all users, including owners, groups, and other users.
For the section on the permission code, the list is:
R: Read permission, the number is code-named "4".
W: Write permission, the number is code-named "2".
X: Execute or toggle the permission, the number is code-named "1".
-: No authority, the number is "0".
S: Special?b> Feature Description: Changes to file or directory permissions. Grammar
chmod [-cfrv][--help][--version][< Permission range >+/-/=< permission settings ... >][files or directories ...]
chmod [-cfrv][--help][--version][Digital Code] [file or directory ...]
chmod [-cfrv][--help][--reference=< Reference file or directory >][--version][file or directory ...] Options Description
The-C or--changes effect is similar to the "-V" parameter but only returns the changed part.
The-F or--quiet or--silent does not display an error message.
-R or--recursive recursively, all files and subdirectories under the specified directory are processed together.
The-V or--verbose displays the instruction execution process.
--help online Help.
--reference=< reference file or directory > set permissions for the specified file or directory to the same permissions as the reference file or directory
--version Displays version information.
< permission settings > permission setting for a file or directory that opens a permission scope.
< permission settings > permission settings for a file or directory that closes the permission range.
< permission range >=< permission settings > This permission setting for a file or directory that specifies a permission scope. Example
Example One : 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
Will Ex1. Set to only the file owner can execute:
chmod u+x Ex1
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.
R=4,w=2,x=1
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.
Example Two :
chmod a=rwx File
And
chmod 777 File
Same effect
chmod ug=rwx,o=x File
And
chmod 771 File
Same effect
If you use chmod 4755 filename, you can make this program have root permissions
example Three :
If you execute after Cd/media/amasun/java/develop/array
chmod 777./
is to set this directory (ie/media/amasun/java/develop/array) for anyone to read, write, execute
If the administrator is often said to the root user, basically have the right to see all the files.