文件权限含义

时间:2015-04-24 21:01:34

标签: linux unix

这些文件权限是什么意思?我无法理解他们我试着看0-7的含义,但我不确定他们什么时候在一起。

-r-------x
----rw---- 
-rwx--x--x

4 个答案:

答案 0 :(得分:1)

作为数字的权限是3个八进制数。例如,555,当转换为3个二进制数时,为101 101 101,其对应于r-x r-x r-x。第一组是所有者,第二组是组,第三组是其他人。

r = read

w =写

x =执行

如果缺少任何一个( - ),那么该集合没有这些权限。

答案 1 :(得分:1)

从左到右,linux文件系统权限是以3s分组的标志

用户(所有者),群组,全部

rwx ------ =用户可以读,写,执行

--- rwx --- =组可以读,写,执行

------ rwx =所有人都可以读写,执行

(我没有故意提及目录或setuid的标志)

接下来,您无需记忆数值来进行设置

chmod与助记符一起使用

chmod a+r设置文件以便All可以读取

chmod g+r设置文件使Group可以读取

chmod u+x设置文件,以便User可以执行

答案 2 :(得分:0)

它也是

所有者|组|所有

-r-------x

所有者可以阅读,群组无能为力,其他人可以超越

----rw---- 

所有者无能为力,小组可以读写,其他人无能为力

-rwx--x--x

所有者拥有完全权限,组可以执行,其他人可以执行。

第一个 - 用于特殊权限,例如粘滞位。

此处a site that may help you

答案 3 :(得分:0)

File permissions

Linux uses the same permissions scheme as Unix. Each file and directory on your system is assigned access rights for the owner of the file, the members of a group of related users, and everybody else. Rights can be assigned to read a file, to write a file, and to execute a file (i.e., run the file as a program).

To see the permission settings for a file, we can use the ls command as follows:

[me@linuxbox me]$ ls -l /bin/bash

-rwxr-xr-x 1 root root  316848 Feb 27  2000 /bin/bash

enter image description here

CHMOD

The chmod command is used to change the permissions of a file or directory. To use it, you specify the desired permission settings and the file or files that you wish to modify. There are two ways to specify the permissions, but I am only going to teach one way.

It is easy to think of the permission settings as a series of bits (which is how the computer thinks about them). Here's how it works:

rwx rwx rwx = 111 111 111
rw- rw- rw- = 110 110 110
rwx --- --- = 111 000 000

and so on...

rwx = 111 in binary = 7
rw- = 110 in binary = 6
r-x = 101 in binary = 5
r-- = 100 in binary = 4

Here is a table of numbers that covers all the common settings. The ones beginning with "7" are used with programs (since they enable execution) and the rest are for other kinds of files.

enter image description here

Directory permissions

The chmod command can also be used to control the access permissions for directories. In most ways, the permissions scheme for directories works the same way as they do with files. However, the execution permission is used in a different way. It provides control for access to file listing and other things. Here are some useful settings for directories:

enter image description here

相关问题