日期:2014-05-16  浏览次数:20627 次

Linux文件或目录的读,写,执行权限

文件或目录的存取权限

Permissions, important and tricky!

Unix permissions concern who can read a file or directory, write to it, and execute it. Permissions are granted or withheld with a magic 3-digit number. The three digits correspond to the owner (you); the group (?); and the world (everyone else).

Think of each digit as a sum:

?

execute permission

= 1

?

write permission

= 2

?

write and execute (1+2)

= 3

?

read permission

= 4

?

read and execute (4+1)

= 5

?

read and write (4+2)

= 6

?

read, write and execute (4+2+1)

= 7


Add the number value of the permissions you want to grant each group to make a three digit number, one digit each for the owner, the group, and the world. Here are some useful combinations. Try to figure them out!

修改方式1:以绝对方式改变权限
chmod 600 {filespec}You can read and write; the world can't. Good for files.

chmod 700 {filespec}You can read, write, and execute; the world can't. Good for scripts.

chmod 644 {filespec}You can read and write; the world can only read. Good for web pages.

chmod 755 {filespec}You can read, write, and execute; the world can read and execute. Good for programs you want to share, and your public_html directory.


Permissions, another way(修改方式2:以符号模式改变权限