linux permissions
Reprinted from: http://hi.baidu.com/im886/blog/item/434764d9f6c210f838012f0b.html
1 [001] Execute permission x
2 [010] Write-only permission w
4 [100] Read-only permission r
sudo chmod 600 ××× (only the owner has read and write permissions)
sudo chmod 644 ××× (owner has read and write permissions, group users only have read permissions)
sudo chmod 700 ××× (only the owner has read and write and execute permissions)
sudo chmod 666 ××× (everyone has read and write permissions)
sudo chmod 777 ××× (everyone has read and write and execute permissions)
Where ××× refers to the file name (it can also be the folder name, but add -ld after chmod).
Explain, in fact, the entire command is in the form of
sudo chmod - (representative type) ××× ( owner ) ××× ( group user ) ××× ( other users )
Each of the three digits represents a user type Permission settings. The value is 0~7, that is, [000]~[111] in binary.
Each bit of this three-digit binary number represents read, write, and execute permissions, respectively.
r:4
w:2
x:1
such as 000 means none of the three permissions, and 100 means read-only. In this way, we have the following correspondence:
0 [000] No permission
1 [001] Execute permission x
2 [010] Write only permission w
4 [100] Read only permission r
6 [110] Read and write permission 7 [111 ] Read and write execute permission /var/www d rwx r-x r-x 3 root root 4096 2010-11-30 12:52 www /var/www/index.php.html -rw-r--r-- 1 root root 210 2010 -11-30 12:52 index.html
-rw-r--r-- 1 root root 20 2010-11-30 12:51 index.php
wrong permissions
drwx------ 13 gg 4096 2010-11-29 17:32 avcha
correct permissions
directory 755 rwx r-x r-x file 644 rw- r-- r -- config writable 666 rw- rw- rw- directory: find path -type d -exec chmod 755 {} \; file: find path -type f -exec chmod 644{}\;
where path is the path of the directory you need to modify
Error can only be single
chmod 755 avcha
chmod 644 file.ext