- 关于文件的权限
r=4,可读
w=2,可写
x=1,可执行
rwx=7(4+2+1) 可读、可写、可执行
r-x=5(4+1) 可读、不可写、可执行
rw-=6(4+2) 可读、可写、不可执行
- 关于用户和组
u,即user,该档案的owner
g,即group,与该档案的owner属于同一个group的人
o,即others,其他以外的人
a,表示上三者皆是
- 写法
chmod {u的权限}{g的权限}{o的权限} file1 file2 ...
或
chmod [ugoa][+-=][rwx] file1 file2 ...
范例:
3.1 指定a.txt为任何人都可读、写、执行
chmod 777 a.txt
chmod a+rwx a.txt
chmod ugo=rwx a.txt
3.2 指定a.txt和b.txt为owner可读写执行,同group的user和其他人仅可读写不可执行
chmod 755 a.txt b.txt
chmod u=rwx,go=rx a.txt b.txt
3.3 指定当前目录下所有文件为任何人都可读、写、执行
chmod -R 777 *
chmod -R a=rwx *