LINUX目录的读、写、执行权限的具体含义

     文件的读写执行权限比较好理解,但是目录的读写执行权限具体含义又是什么呢?

目录读权限:表示用户可以用ls命令将目录下的具体子目录和文件罗列出来。

示例

test1@ubuntu:/home/dyp930/work$ mkdir temp
test1@ubuntu:/home/dyp930/work$ ls -lrt
total 4
drwxrwxr-x 2 test1 test1 4096 Jun 28 05:32 temp
test1@ubuntu:/home/dyp930/work$ chmod u-r temp  //将所属用户对该目录的读权限删除。
test1@ubuntu:/home/dyp930/work$ ls -lrt
total 4
d-wxrwxr-x 2 test1 test1 4096 Jun 28 05:32 temp
test1@ubuntu:/home/dyp930/work$ ls -lrt temp   //发现无法ls 这个目录了。
ls: cannot open directory temp: Permission denied
test1@ubuntu:/home/dyp930/work$ chmod u+r temp  
test1@ubuntu:/home/dyp930/work$ ls -lrt temp   //重新添加读权限就可以了。
total 0
test1@ubuntu:/home/dyp930/work$           //备注,一般所有者对目录是有读写执行权限的。

目录写权限:表示用户可以在该目录下可创建子目录或者文件。

示例

test1@ubuntu:/home/dyp930/work$ ls -lrt
total 4
drwxrwxr-x 2 test1 test1 4096 Jun 28 05:32 temp
test1@ubuntu:/home/dyp930/work$ chmod u-w temp   //去除目录所有者对该目录的写权限。如下,无法在该目录下创建子目录和文件了。
test1@ubuntu:/home/dyp930/work$ cd temp
test1@ubuntu:/home/dyp930/work/temp$ ls -lrt
total 0
test1@ubuntu:/home/dyp930/work/temp$ mkdir test
mkdir: cannot create directory ‘test’: Permission denied
test1@ubuntu:/home/dyp930/work/temp$ touch test.txt
touch: cannot touch ‘test.txt’: Permission denied
test1@ubuntu:/home/dyp930/work/temp$ 

目录执行权限:表示可以用cd进入该目录

示例

test1@ubuntu:/home/dyp930/work$ ls -lrt
total 4
dr-xrwxr-x 2 test1 test1 4096 Jun 28 05:32 temp
test1@ubuntu:/home/dyp930/work$ chmod u-x temp     //去除目录所有者对该目录的执行权限,则cd命令无法进入了。
test1@ubuntu:/home/dyp930/work$ ls -lrt
total 4
dr--rwxr-x 2 test1 test1 4096 Jun 28 05:32 temp
test1@ubuntu:/home/dyp930/work$ cd temp
bash: cd: temp: Permission denied
test1@ubuntu:/home/dyp930/work$ 

--完结。


  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值