分享

Linux怎么设置文件文件夹的权限chmod命令

 GLL_ 2018-04-12

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


    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多