以二进制和八进制方式表示文件模式

  r w x 2^3=9

文件类型

-

d

l

c

b

所有者、组、其他用户

1+3^3=10

 u g o 

a=all

c 字符设备文件 ,该文件类型表示以字节流形式处理数据的设备,入终端或调制解调器

b 块设备文件,该文件类型表示以数据块方式处理数据的设备,入硬盘驱动或者光盘驱动

0=000

1=001

2=010

3=011

4=100

5=101

6=110

7=111

chmod 600 ~/foo.txt  设置文件所有者具有读写权限,而取消其他所有用户的所有权限

rwx

读写执行

chmod u=rw,go=---  ~/foo.txt

u+x 为所有者添加可执行权限

u-x                删除

+x      所有者、所有者所属群组、其他所有用户添加可执行权限     a+x

o-rw

go=rw

8进制中1个数字代表2进制中的3个数字,16-4

动手

[root@hadoop2 apiserver]# ll -as
total 60
4 d-wx--x--x 2 root root 4096 Dec 8 14:24 .
4 drwxr-xr-x 9 root root 4096 Dec 7 20:07 ..
12 -rwxr-xr-x 1 root root 10305 Dec 8 17:54 chk_this_uid_url.py
8 -rwxr-xr-x 1 root root 6557 Dec 8 15:06 chk_this_uid_url_run_cmd.py
12 -rwxr-xr-x 1 root root 10846 Dec 8 15:48 chk_this_uid_url_send_cmd.py
4 -rwxr-xr-x 1 root root 2784 Dec 8 14:52 chk_this_uid_url_send_cmd.py.log
0 -rwxr-xr-x 1 root root 0 Dec 7 20:02 __init__.py
4 -rwxr-xr-x 1 root root 145 Dec 8 15:20 tcmd.py
4 -rwxr-xr-x 1 root root 2742 Dec 8 14:42 tcmd.py.log
4 -rwxr-xr-x 1 root root 1044 Dec 8 13:47 t.py
4 -rwxr-xr-x 1 root root 2212 Dec 5 15:39 ua_list.txt
[root@hadoop2 apiserver]# chmod a-x *
[root@hadoop2 apiserver]# ll -as
total 60
4 d-wx--x--x 2 root root 4096 Dec 8 14:24 .
4 drwxr-xr-x 9 root root 4096 Dec 7 20:07 ..
12 -rw-r--r-- 1 root root 10305 Dec 8 17:54 chk_this_uid_url.py
8 -rw-r--r-- 1 root root 6557 Dec 8 15:06 chk_this_uid_url_run_cmd.py
12 -rw-r--r-- 1 root root 10846 Dec 8 15:48 chk_this_uid_url_send_cmd.py
4 -rw-r--r-- 1 root root 2784 Dec 8 14:52 chk_this_uid_url_send_cmd.py.log
0 -rw-r--r-- 1 root root 0 Dec 7 20:02 __init__.py
4 -rw-r--r-- 1 root root 145 Dec 8 15:20 tcmd.py
4 -rw-r--r-- 1 root root 2742 Dec 8 14:42 tcmd.py.log
4 -rw-r--r-- 1 root root 1044 Dec 8 13:47 t.py
4 -rw-r--r-- 1 root root 2212 Dec 5 15:39 ua_list.txt
[root@hadoop2 apiserver]# chmod a+x *
[root@hadoop2 apiserver]# ll -as
total 60
4 d-wx--x--x 2 root root 4096 Dec 8 14:24 .
4 drwxr-xr-x 9 root root 4096 Dec 7 20:07 ..
12 -rwxr-xr-x 1 root root 10305 Dec 8 17:54 chk_this_uid_url.py
8 -rwxr-xr-x 1 root root 6557 Dec 8 15:06 chk_this_uid_url_run_cmd.py
12 -rwxr-xr-x 1 root root 10846 Dec 8 15:48 chk_this_uid_url_send_cmd.py
4 -rwxr-xr-x 1 root root 2784 Dec 8 14:52 chk_this_uid_url_send_cmd.py.log
0 -rwxr-xr-x 1 root root 0 Dec 7 20:02 __init__.py
4 -rwxr-xr-x 1 root root 145 Dec 8 15:20 tcmd.py
4 -rwxr-xr-x 1 root root 2742 Dec 8 14:42 tcmd.py.log
4 -rwxr-xr-x 1 root root 1044 Dec 8 13:47 t.py
4 -rwxr-xr-x 1 root root 2212 Dec 5 15:39 ua_list.txt
[root@hadoop2 apiserver]#

原文地址:https://www.cnblogs.com/rsapaper/p/7953703.html