免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 666 | 回复: 0
打印 上一主题 下一主题

目录访问权限问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-10-05 15:42 |只看该作者 |倒序浏览
By zieckey@yahoo.com.cn
为了打开文件 temp/txt ,需要对当前工作目录 .、temp/目录具有执行权限。然后对该文件temp/txt还要有想应权限,
这取决于你以何种模式打开它(只读、读写等)。
但是这个对于root用户来说,似乎不起作用。可以看下面的实验
[zieckey@localhost ~]$ mkdir temp
[zieckey@localhost ~]$ ls
temp
[zieckey@localhost ~]$ echo aaaaa > temp/txt
[zieckey@localhost ~]$ ls temp/
txt
[zieckey@localhost ~]$ cat temp/txt
aaaaa
[zieckey@localhost ~]$ ll temp/
总计 8
-rw-rw-r-- 1 zieckey zieckey 6 10-05 15:10 txt
[zieckey@localhost ~]$ chmod a-r temp/txt
[zieckey@localhost ~]$ cat temp/txt
cat: temp/txt: 权限不够
[zieckey@localhost ~]$ echo BBBB >> temp/txt
[zieckey@localhost ~]$ cat temp/txt
cat: temp/txt: 权限不够
[zieckey@localhost ~]$ chmod a+r temp/txt
[zieckey@localhost ~]$ cat temp/txt
aaaaa
BBBB
[zieckey@localhost ~]$ echo ccccc >> temp/txt
[zieckey@localhost ~]$ cat temp/txt
aaaaa
BBBB
ccccc
[zieckey@localhost ~]$ chmod a-w temp/txt
[zieckey@localhost ~]$ echo ddddddd >> temp/txt
bash: temp/txt: 权限不够
[zieckey@localhost ~]$ ll
总计 8
drwxrwxr-x 2 zieckey zieckey 4096 10-05 15:10 temp
[zieckey@localhost ~]$ chmod a-x temp/
[zieckey@localhost ~]$ cd temp/
bash: cd: temp/: 权限不够
[zieckey@localhost ~]$ cat temp/txt
cat: temp/txt: 权限不够
[zieckey@localhost ~]$ ll
总计 8
drw-rw-r-- 2 zieckey zieckey 4096 10-05 15:10 temp
[zieckey@localhost ~]$
[zieckey@localhost ~]$ su root
口令:
[root@localhost zieckey]# ll temp/txt
-r--r--r-- 1 zieckey zieckey 17 10-05 15:12 temp/txt
[root@localhost zieckey]# cat temp/txt
aaaaa
BBBB
ccccc
[root@localhost zieckey]# ll temp
总计 8
-r--r--r-- 1 zieckey zieckey 17 10-05 15:12 txt
[root@localhost zieckey]# ll
总计 8
drw-rw-r-- 2 zieckey zieckey 4096 10-05 15:10 temp
[root@localhost zieckey]# chmod a-rwx temp/
[root@localhost zieckey]# cat temp/txt
aaaaa
BBBB
ccccc
[root@localhost zieckey]#
对于root用户,即使所有的权限都没有了‘chmod a-rwx temp/’ 也能对该temp/目录进行任何操作。这难道就是root用户的超级权限吗?
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/16292/showart_1272911.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP