NAME
chmod - 改变文件的访问权限
总揽
chmod [options] mode file...
POSIX 选项:
[-R]
GNU 选项 (最短方式): [-cfvR] [--reference=rfile] [--help] [--version]
[--]
描述
使用chmod命令改变指定文件访问权限有两种方式:一种是用符号
标记所进行更改,另一种方式是采用8进制数指定新的访问权限。
POSIX 选项
-R 改变目录及目录下的内容的访问权限.
GNU 选项
-c, --changes
只有在文件的权限确实改变时才进行详细的说明
-f, --silent, --quiet
不输出权限不能改变的文件的错误信息
-v, --verbose
详细说明权限的变化
-R, --recursive
改变目录及其所有子目录的文件的权限
tarena@ubuntu:~/uc/day07$ chmod -R a-x aaa
tarena@ubuntu:~/uc/day07$ cd aaa
bash: cd: aaa: 权限不够
tarena@ubuntu:~/uc/day07$ chmod -R a-x aaa
chmod: 无法读取目录"aaa": 权限不够
tarena@ubuntu:~/uc/day07$ ls -l
总用量 16
d-w--w---- 2 tarena tarena 4096 4月 12 22:02 aaa
-rw-rw-r-- 1 tarena tarena 26 4月 11 13:13 day07.txt
-rw-rw-r-- 1 tarena tarena 8 4月 11 13:55 hello2.c
-rw-rw-r-- 1 tarena tarena 8 4月 11 13:24 hello.c
tarena@ubuntu:~/uc/day07$
tarena@ubuntu:~/uc/day07$ chmod -R a+x aaa
chmod: 无法读取目录"aaa": 权限不够
tarena@ubuntu:~/uc/day07$ cd aaa
tarena@ubuntu:~/uc/day07/aaa$
tarena@ubuntu:~/uc/day07$ ls -l
总用量 16
d-wx-wx--x 2 tarena tarena 4096 4月 12 22:02 aaa
-rw-rw-r-- 1 tarena tarena 26 4月 11 13:13 day07.txt
-rw-rw-r-- 1 tarena tarena 8 4月 11 13:55 hello2.c
-rw-rw-r-- 1 tarena tarena 8 4月 11 13:24 hello.c