(rwx------) This area is for owner.
(---rwx---) This area is for group owner.
(------rwx) This area is for others.
(-rwx------) The preceding - indicates a directory.
Value | Meaning
|
==========================================================================================================================================================================================================
|
777 (rwxrwxrwx) | No restrictions on permissions. Anybody may do anything. Generally not a desirable setting.
755 (rwxr-xr-x) | The file's owner may read, write, and execute the file. All others may read and execute the file. This setting is common for programs that are used by all users.
700 (rwx------) | The file's owner may read, write, and execute the file. Nobody else has any rights. This setting is useful for programs that only the owner may use and must be kept private from others.
666 (rw-rw-rw-) | All users may read and write the file.
644 (rw-r--r--) | The owner may read and write a file, while all others may only read the file. A common setting for data files that everybody may read, but only the owner may change.
600 (rw-------) | The owner may read and write a file. All others have no rights. A common setting for data files that the owner wants to keep private.
将数据附加到文件需要文件本身的写入权限。删除文件需要对包含文件的目录具有写权限。
例如,我有一个名为 testdir 的目录,我已经删除了该目录的写权限:
在目录中,我创建了一个名为 testfile.txt 的文件(这是在删除目录的写权限之前完成的)。
现在,我可以将数据附加到文件中,因为我对它有写权限:
但我无法删除该文件,因为我对其父目录没有写权限。
您可以查看此问题以获取有关目录权限的更多详细信息:执行与读取位。Linux 中的目录权限是如何工作的?
目录与文件权限无关。该文件如果也可以写入,也可以删除。您可以尝试 ACL,例如:How to give permissions to read write but not delete the file,但这很容易解决。
以下是文件权限的说明: