Linux文件权限管理命令及演示

chmod,chown,chgrp

chmod
  • chmod
  • chown
  • chgrp
  1. 此三个命令,都是更改权限相关的,一起进行演示
  2. 以下演示当中对权限的设置可能存在不妥,忽略即可,主要关注命令的演示。
  • 命令演示
    [root@localhost mytest]# ll /etc/fstab
    -rw-r--r--. 1 root root 465 7月 3 12:39 /etc/fstab
    [root@localhost ~]# cp /etc/fstab /tmp/mytest/fstab.test
    [root@localhost ~]# ll /tmp/mytest
    总用量 8
    -rw-r--r--. 1 root root 465 8月 8 23:35 fstab.test
    -rw-r--r--. 1 root root 9 8月 4 07:47 passwd.test
    drwxr-xr-x. 3 root root 17 7月 23 10:07 var
    [root@localhost ~]# cd !$
    cd /tmp/mytest
    [root@localhost mytest]# chmod g=rw fstab.test
    [root@localhost mytest]# ll
    总用量 8
    -rw-r--r--. 1 root root 9 8月 4 07:47 passwd.test
    ........
    [root@localhost mytest]# chmod o=rwx fstab.test
    [root@localhost mytest]# ll fstab.test
    -rw-rw-rwx. 1 root root 465 8月 8 23:35 fstab.test
    [root@localhost mytest]# chmod ugo=r fstab.test
    [root@localhost mytest]# ll fstab.test
    -r--r--r--. 1 root root 465 8月 8 23:35 fstab.test
    [root@localhost mytest]# chmod a=rw fstab.test
    [root@localhost mytest]# ll fstab.test
    -rw-rw-rw-. 1 root root 465 8月 8 23:35 fstab.test
    [root@localhost mytest]# ll /etc/fstab
    -rw-r--r--. 1 root root 465 7月 3 12:39 /etc/fstab
    [root@localhost mytest]# chmod --reference=/etc/fstab fstab.test
    [root@localhost mytest]# ll fstab.test
    -rw-r--r--. 1 root root 465 8月 8 23:35 fstab.test
    [root@localhost mytest]# chmod u+x fstab.test
    [root@localhost mytest]# ll fstab.test
    -rwxr--r--. 1 root root 465 8月 8 23:35 fstab.test
    [root@localhost mytest]# chmod g+w,o+w fstab.test
    [root@localhost mytest]# ll fstab.test
    -rwxrw-rw-. 1 root root 465 8月 8 23:35 fstab.test
    [root@localhost mytest]# chmod go-w fstab.test
    [root@localhost mytest]# ll fstab.test
    -rwxr--r--. 1 root root 465 8月 8 23:35 fstab.test
    [root@localhost mytest]# chmod u-x fstab.test
    [root@localhost mytest]# ll fstab.test
    -rw-r--r--. 1 root root 465 8月 8 23:35 fstab.test
    [root@localhost mytest]# chmod +x fstab.test
    [root@localhost mytest]# ll fstab.test
    -rwxr-xr-x. 1 root root 465 8月 8 23:35 fstab.test
    [root@localhost mytest]# chmod +w fstab.test
    [root@localhost mytest]# ll fstab.test
    -rwxr-xr-x. 1 root root 465 8月 8 23:35 fstab.test
    [root@localhost mytest]# chmod -x fstab.test
    [root@localhost mytest]# ll fstab.test
    -rw-r--r--. 1 root root 465 8月 8 23:35 fstab.test
    [root@localhost mytest]# chmod 611 fstab.test
    [root@localhost mytest]# ll fstab.test
    -rw---x--x. 1 root root 465 8月 8 23:35 fstab.test
    [root@localhost mytest]# chmod 500 fstab.test
    [root@localhost mytest]# ll fstab.test
    -r-x------. 1 root root 465 8月 8 23:35 fstab.test
    [root@localhost mytest]# chmod 020 fstab.test
    [root@localhost mytest]# ll fstab.test
    -----w----. 1 root root 465 8月 8 23:35 fstab.test
    [root@localhost mytest]# chmod 2 fstab.test
    [root@localhost mytest]# ll fstab.test
    --------w-. 1 root root 465 8月 8 23:35 fstab.test
    [root@localhost mytest]# chmod 04 fstab.test
    [root@localhost mytest]# ll fstab.test
    -------r--. 1 root root 465 8月 8 23:35 fstab.test
    [root@localhost mytest]# chmod 040 fstab.test
    [root@localhost mytest]# ll fstab.test
    ----r-----. 1 root root 465 8月 8 23:35 fstab.test
    [root@localhost mytest]# chmod --reference=/etc/fstab fstab.test
    [root@localhost mytest]# ll fstab.test
    -rw-r--r--. 1 root root 465 8月 8 23:35 fstab.test
    [root@localhost mytest]# su centos2
    [centos2@localhost mytest]$ pwd
    /tmp/mytest
    [centos2@localhost mytest]$
    [centos2@localhost mytest]$ head fstab.test

# /etc/fstab
........
[root@localhost mytest]# chmod o-r fstab.test
[root@localhost mytest]# ll fstab.test
-rw-r-----. 1 root root 465 8月 8 23:35 fstab.test
[root@localhost mytest]# su centos2
[centos2@localhost mytest]$ head -1 fstab.test
head: 无法打开"fstab.test" 读取数据: 权限不够
[centos2@localhost mytest]$ exit
[root@localhost mytest]# chown centos2 fstab.test
[root@localhost mytest]# ll fstab.test
-rw-r-----. 1 centos2 root 465 8月 8 23:35 fstab.test
[root@localhost mytest]# su -c "head -5 fstab.test" centos2

# /etc/fstab
# Created by anaconda on Tue May 30 06:31:44 2017

[root@localhost mytest]# su -c "head -5 fstab.test" centos1
head: 无法打开"fstab.test" 读取数据: 权限不够
[root@localhost mytest]# chown centos1:centos fstab.test
[root@localhost mytest]# ll fstab.test
-rw-r-----. 1 centos1 centos 465 8月 8 23:35 fstab.test
[root@localhost mytest]# su -c "head -2 fstab.test" centos1

[root@localhost mytest]# su -c "head -2 fstab.test" centos2

[root@localhost mytest]# grep centos /etc/group
centos1:x:1000:
centos2:x:1001:
centos3:x:1002:
centos4:x:1003:
centos:x:1006:centos2
[root@localhost mytest]# su centos3
[centos3@localhost mytest]$ head -2 fstab.test
head: 无法打开"fstab.test" 读取数据: 权限不够
[centos3@localhost mytest]$ ll fstab.test
-rw-r-----. 1 centos1 centos 465 8月 8 23:35 fstab.test
[centos3@localhost mytest]$ id
uid=1002(centos3) gid=1002(centos3) 组=1002(centos3) 环境=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[centos3@localhost mytest]$ newgrp centos
密码:
[centos3@localhost mytest]$ id
uid=1002(centos3) gid=1006(centos) 组=1006(centos),1002(centos3) 环境=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[centos3@localhost mytest]$ head -2 fstab.test

[centos3@localhost mytest]$ exit
[root@localhost mytest]# ll fstab.test
-rw-r-----. 1 centos1 centos 465 8月 8 23:35 fstab.test
[root@localhost mytest]# su -c "head -2 fstab.test" centos4
head: 无法打开"fstab.test" 读取数据: 权限不够
[root@localhost mytest]# chgrp centos4 fstab.test
[root@localhost mytest]# ll fstab.test
-rw-r-----. 1 centos1 centos4 465 8月 8 23:35 fstab.test
[root@localhost mytest]# su -c "head -2 fstab.test" centos4

[root@localhost mytest]# ll fstab.test
-rw-r-----. 1 centos1 centos4 465 8月 8 23:35 fstab.test
[root@localhost mytest]# ll /etc/fstab
-rw-r--r--. 1 root root 465 7月 3 12:39 /etc/fstab
[root@localhost mytest]# chown --reference=/etc/fstab fstab.test
[root@localhost mytest]# ll fstab.test
-rw-r-----. 1 root root 465 8月 8 23:35 fstab.test
[root@localhost mytest]# chown centos1:centos fstab.test
[root@localhost mytest]# ll fstab.test
-rw-r-----. 1 centos1 centos 465 8月 8 23:35 fstab.test
[root@localhost mytest]# chgrp --reference=/etc/fstab fstab.test
[root@localhost mytest]# ll fstab.test
-rw-r-----. 1 centos1 root 465 8月 8 23:35 fstab.test
[root@localhost mytest]# chown --reference=/etc/fstab fstab.test
[root@localhost mytest]# ll fstab.test
-rw-r-----. 1 root root 465 8月 8 23:35 fstab.test
[root@localhost mytest]# mkdir -p xiangjis/al
[root@localhost mytest]# touch xiangjis/al/du
[root@localhost mytest]# ll -d xiangjis
drwxr-xr--. 3 root root 16 8月 9 22:58 xiangjis
[root@localhost mytest]# ll -R xiangjis
xiangjis:
总用量 0
drwxr-xr--. 2 root root 16 8月 9 23:16 al
 
xiangjis/al:
总用量 0
-rw-r--r--. 1 root root 0 8月 9 23:16 du
[root@localhost mytest]# chmod -R g+w xiangjis
[root@localhost mytest]# ll xiangjis/al
总用量 0
-rw-rw-r--. 1 root root 0 8月 9 23:16 du
[root@localhost mytest]# ll -d xiangjis/al
drwxrwxr--. 2 root root 16 8月 9 23:16 xiangjis/al
[root@localhost mytest]# ll -d xiangjis
drwxrwxr--. 3 root root 16 8月 9 22:58 xiangjis
[root@localhost mytest]# chown -R centos1:centos xiangjis
[root@localhost mytest]# ll -d xiangjis
drwxrwxr--. 3 centos1 centos 16 8月 9 22:58 xiangjis
[root@localhost mytest]# ll -R xiangjis
xiangjis:
总用量 0
drwxrwxr--. 2 centos1 centos 16 8月 9 23:16 al
 
xiangjis/al:
总用量 0
-rw-rw-r--. 1 centos1 centos 0 8月 9 23:16 du
[root@localhost mytest]# chgrp -R root xiangjis
[root@localhost mytest]# ll -d xiangjis
drwxrwxr--. 3 centos1 root 16 8月 9 22:58 xiangjis
[root@localhost mytest]# ll -R xiangjis
xiangjis:
总用量 0
drwxrwxr--. 2 centos1 root 16 8月 9 23:16 al
 
xiangjis/al:
总用量 0
-rw-rw-r--. 1 centos1 root 0 8月 9 23:16 du
[root@localhost mytest]# ll fstab.test
-rw-r-----. 1 root root 465 8月 8 23:35 fstab.test
[root@localhost mytest]# chown -R --reference=fstab.test xiangjis
[root@localhost mytest]# ll -d xiangjis
drwxrwxr--. 3 root root 16 8月 9 22:58 xiangjis
[root@localhost mytest]# ll -R xiangjis
xiangjis:
总用量 0
drwxrwxr--. 2 root root 16 8月 9 23:16 al
 
xiangjis/al:
总用量 0
-rw-rw-r--. 1 root root 0 8月 9 23:16 du
[root@localhost mytest]#

umask

文件的权限反向掩码,遮罩码;用来设置限制新建文件权限的掩码

  • 文件:默认建立文件的 权限计算方式为,666-umask
  • 目录:默认建立目录的权限计算方式为,777-umask
  • 注意:之所以文件用666减,表示文件默认不能拥有执行权限;如果减得的结果中有执行权限,则需要将其加1
  • umask命令
    • umask,常看当前shell进程的umask
    • umask -S,以字符形式显示当前的掩码
    • umask MASK,设置umask的值;指定哪些权限在新文件的默认权限中被删除。只对当前shell进程有效
  • 命令演示、
    [root@localhost mytest]# umask   \\显示当前umask值
    0022
    [root@localhost mytest]# umask -S   \\字符形式显示权限位,为文件夹的默认权限
    u=rwx,g=rx,o=rx
    [root@localhost mytest]# touch test   \\666-022=644
    [root@localhost mytest]# ll test
    -rw-r--r--. 1 root root 0 8月 11 07:10 test
    [root@localhost mytest]# mkdir dy1   \\777-022=755
    [root@localhost mytest]# ll -d dy1
    drwxr-xr-x. 2 root root 6 8月 11 07:25 dy1
    [root@localhost mytest]# su centos1
    [centos1@localhost mytest]$ whoami
    centos1
    [centos1@localhost mytest]$ cd
    [centos1@localhost ~]$ pwd
    /home/centos1
    [centos1@localhost ~]$ touch test1      \\666-002=664
    [centos1@localhost ~]$ mkdir dy2      \\777-002=775
    [centos1@localhost ~]$ umask   \\普通用户的umask值
    0002
    [centos1@localhost ~]$ ll      \\666-002=664
    总用量 0
    drwxrwxr-x. 2 centos1 centos1 6 8月 11 07:31 dy2
    -rw-rw-r--. 1 centos1 centos1 0 8月 11 07:31 test1
    [root@localhost mytest]# umask 122      \\更改默认值,即新建文件的属主有执行权限(默认666已是没有x权限,现在umask减掉x权限,双减即有,我是这样理解的)新建目录属主没有执行权限(这样很不合理,纯属演示命令效果)
    [root@localhost mytest]# umask
    0122
    [root@localhost mytest]# touch test1      \\666-122=544
    [root@localhost mytest]# mkdir dy2      \\777-122=655
    [root@localhost mytest]# ll test      \\因为文件默认不能拥有执行权限,故权限位加1,为644
    -rw-r--r--. 1 root root 0 8月 11 07:10 test
    -rw-r--r--. 1 root root 0 8月 11 07:33 test1
    [root@localhost mytest]# ll -d dy

    drwxr-xr-x. 2 root root 6 8月 11 07:25 dy1
    drw-r-xr-x. 2 root root 6 8月 11 07:34 dy2
    [root@localhost mytest]# umask -S      \\显示目录权限
    u=rw,g=rx,o=rx
    [root@localhost mytest]# umask 023      \\更改默认值,即新建文件的其它用户拥有执行权限(默认666已是没有x权限,现在umask减掉x权限,双减即有,我是这样理解的)新建目录其它用户没有执行权限(这样很不合理,纯属演示命令效果)
    [root@localhost mytest]# touch test3      \\666-023=643
    [root@localhost mytest]# mkdir dy3      \\777-023=754
    [root@localhost mytest]# ll test      \\因为文件默认不能拥有执行权限,故权限位加1,为644
    -rw-r--r--. 1 root root 0 8月 11 07:10 test
    -rw-r--r--. 1 root root 0 8月 11 07:33 test1
    -rw-r--r--. 1 root root 0 8月 11 07:36 test3
    [root@localhost mytest]# ll -d dy

    drwxr-xr-x. 2 root root 6 8月 11 07:25 dy1
    drw-r-xr-x. 2 root root 6 8月 11 07:34 dy2
    drwxr-xr--. 2 root root 6 8月 11 07:36 dy3
    [root@localhost mytest]# umask
    0023
    [root@localhost mytest]# 登出      \\登录,模拟结束当前shell进程
    [root@localhost ~]# umask      \\重新登录,新的shell进程下,umask值又回到默认
    0022
    [root@localhost ~]#
权限说明
  • 权限说明
  • 权限演示
    为加强对权限说明的理解,出以下题目,并作演示

  • 问题
    用户对目录有写权限,但对目录下的文件没有写权限,能否修改此文件内容?能否删除此文件?(演示后边会有结论及总结,耐心看完演示哦)
    [root@localhost mytest]# mkdir xiangjis
    [root@localhost mytest]# touch xiangjis/fedora
    [root@localhost mytest]# ll xiangjis   \\查看文件的权限
    总用量 0
    -rw-r--r--. 1 root root 0 8月 11 10:26 fedora
    [root@localhost mytest]# ll -d xiangjis   \\查看目录的权限
    drwxr-xr-x. 2 root root 20 8月 11 10:26 xiangjis
    [root@localhost mytest]# chgrp -R centos xiangjis   \\ 更改目录及其下文件的属主
    [root@localhost mytest]# ll -d xiangjis
    drwxrwxr-x. 2 root centos 20 8月 11 10:26 xiangjis
    [root@localhost mytest]# ll xiangjis
    总用量 0
    -rw-r--r--. 1 root centos 0 8月 11 10:26 fedora
    [root@localhost mytest]# su centos2   \\ 切换到组centos下的成员centos2登录
    [centos2@localhost mytest]$ pwd
    /tmp/mytest
    [centos2@localhost mytest]$ ll -d   \\ centos2在当前目录下属于other,所以没有w的权限
    drwxr-xr-x. 5 root root 68 8月 11 13:34 .
    [centos2@localhost mytest]$ touch xiangjis/fedora2   \\ centos2在/tmp/mytest目录下不能创建文件及目录
    touch: 无法创建"xiangjis/fedora2": 权限不够
    [centos2@localhost mytest]$ pwd
    /tmp/mytest
    [centos2@localhost mytest]$ cd xiangjis
    [centos2@localhost xiangjis]$ pwd
    /tmp/mytest/xiangjis
    [centos2@localhost xiangjis]$ touch fedora2   \\ centos2属于centos组,应用组权限在/tmp/mytest/xiangjis目录下可以创建文件
    [centos2@localhost xiangjis]$ ll
    总用量 0
    -rw-r--r--. 1 root centos 0 8月 11 10:26 fedora
    -rw-rw-r--. 1 centos2 centos2 0 8月 11 10:32 fedora2
    [centos2@localhost xiangjis]$ rm fedora2
    [centos2@localhost xiangjis]$ exit
    [root@localhost mytest]# ll -d xiangjis
    drwxrwxr-x. 2 root centos 20 8月 11 10:33 xiangjis
    [root@localhost mytest]# chmod g-w xiangjis   \\ 取消组的写权限
    [root@localhost mytest]# ll -d xiangjis
    drwxr-xr-x. 2 root centos 20 8月 11 10:33 xiangjis
    [root@localhost mytest]# su centos2
    [centos2@localhost mytest]$ cd xiangjis
    [centos2@localhost xiangjis]$ pwd
    /tmp/mytest/xiangjis
    [centos2@localhost xiangjis]$ ll
    总用量 0
    -rw-r--r--. 1 root centos 0 8月 11 10:26 fedora
    [centos2@localhost xiangjis]$ touch fedora2   \\ 组对目录没有写权限,此时centos2在该目录不能创建文件
    touch: 无法创建"fedora2": 权限不够
    [centos2@localhost xiangjis]$ exit
    [root@localhost mytest]# chmod -R o+w xiangjis   \\ 给other用户赋予写权限,同时组权限为读和执行
    [root@localhost mytest]# ll -d xiangjis
    drwxr-x****rwx. 2 root centos 20 8月 11 10:33 xiangjis
    [root@localhost mytest]# ll xiangjis
    总用量 0
    -rw-r--rw-. 1 root centos 0 8月 11 10:26 fedora
    [root@localhost mytest]# grep centos /etc/group
    centos1:x:1000:
    centos2:x:1001:
    centos3:x:1002:
    centos4:x:1003:
    centos:x:1006:centos2
    [root@localhost mytest]# su centos3
    [centos3@localhost mytest]$ pwd
    /tmp/mytest
    [centos3@localhost mytest]$ cd xiangjis
    [centos3@localhost xiangjis]$ touch fedora3   \\ other用户centos3可以创建文件
    [centos3@localhost xiangjis]$ ll
    总用量 0
    -rw-r--rw-. 1 root centos 0 8月 11 10:26 fedora
    -rw-rw-r--. 1 centos3 centos3 0 8月 11 10:42 fedora3
    [centos3@localhost xiangjis]$ newgrp centos   \\centos3临时切换主组为centos
    密码:
    [centos3@localhost xiangjis]$ id
    uid=1002(centos3) gid=1006(centos) 组=1006(centos),1002(centos3) 环境=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
    [centos3@localhost xiangjis]$ touch fedora3.1   \\此时应用组centos的权限,故不能创建文件
    touch: 无法创建"fedora3.1": 权限不够
    [centos3@localhost xiangjis]$ exit
    [root@localhost mytest]# chmod -R o-w xiangjis
    [root@localhost mytest]# chmod g+w xiangjis   \\centos组增加写权限
    [root@localhost mytest]# su centos2
    [centos2@localhost mytest]$ cd xiangjis
    [centos2@localhost xiangjis]$ pwd
    /tmp/mytest/xiangjis
    [centos2@localhost xiangjis]$ ll
    总用量 4
    -rw-r--r--. 1 root centos 5 8月 11 10:44 fedora
    -rw-rw-r--. 1 centos3 centos3 0 8月 11 10:42 fedora3
    [centos2@localhost xiangjis]$ ll -d
    drwxrwxr-x. 2 root centos 35 8月 11 10:42 .
    [centos2@localhost xiangjis]$ touch fedora2   \\此时centos2应用组的权限,即写权限,故可以创建文件
    [centos2@localhost xiangjis]$ ll
    总用量 4
    -rw-r--r--. 1 root centos 5 8月 11 10:44 fedora
    -rw-rw-r--. 1 centos2 centos2 0 8月 11 10:48 fedora2
    -rw-rw-r--. 1 centos3 centos3 0 8月 11 10:42 fedora3
    [centos2@localhost xiangjis]$ echo love >> fedora   \\此时centos2应用组的权限,即使对目录有写权限,但对该目录的文件没有写权限,故无法修改文件fedora
    bash: fedora: 权限不够
    [centos2@localhost xiangjis]$ rm fedora\\此时centos2应用组的权限,即写权限,故可以删除文件
    rm:是否删除有写保护的普通文件 "fedora"?yes
    [centos2@localhost xiangjis]$ ll
    总用量 0
    -rw-rw-r--. 1 centos2 centos2 0 8月 11 10:48 fedora2
    -rw-rw-r--. 1 centos3 centos3 0 8月 11 10:42 fedora3
    [centos2@localhost xiangjis]$ exit
    [root@localhost mytest]# chmod o-x xiangjis
    [root@localhost mytest]# chmod g-w xiangjis
    [root@localhost mytest]# ll -d xiangjis   \\other用户对目录只有读权限,且组有读和执行权限
    drwxr-xr--. 2 root centos 36 8月 11 10:49 xiangjis
    [root@localhost mytest]# su centos3
    [centos3@localhost mytest]$ ll xiangjis   \\other用户对目录没有执行权限,故centos3无法ls查看目录下的内容
    ls: 无法访问xiangjis/fedora3: 权限不够
    ls: 无法访问xiangjis/fedora2: 权限不够
    总用量 0
    -????????? ? ? ? ? ? fedora2
    -????????? ? ? ? ? ? fedora3
    [centos3@localhost mytest]$ pwd
    /tmp/mytest
    [centos3@localhost mytest]$ cd xiangjis   \\other用户对目录没有执行权限,故centos3无法cd到目录下,即无法切换工作目录
    bash: cd: xiangjis: 权限不够
    [centos3@localhost mytest]$ newgrp centos   \\临时切换主组为centos
    密码:
    [centos3@localhost mytest]$ id
    uid=1002(centos3) gid=1006(centos) 组=1006(centos),1002(centos3) 环境=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
    [centos3@localhost mytest]$ cd xiangjis   \\应用组权限,可以切换工作目录
    [centos3@localhost xiangjis]$ pwd
    /tmp/mytest/xiangjis
    [centos3@localhost xiangjis]$ exit
    [centos3@localhost mytest]$ exit
    [root@localhost mytest]# chmod o-r xiangjis
    [root@localhost mytest]# chmod o+x xiangjis
    [root@localhost mytest]# ll -d xiangjis   \\other只有执行权限
    drwxr-x--x. 2 root centos 36 8月 11 10:49 xiangjis
    [root@localhost mytest]# su centos3
    [centos3@localhost mytest]$ ll xiangjis   \\other用户对目录没有读权限,故centos3无法ls查看目录下的内容
    ls: 无法打开目录xiangjis: 权限不够
    [centos3@localhost mytest]$ cd xiangjis   \\other用户对目录有执行权限,故centos3可以切换工作目录
    [centos3@localhost xiangjis]$ pwd
    /tmp/mytest/xiangjis
    [centos3@localhost xiangjis]$ ll   \\other用户对目录只有执行权限,虽然能cd到目录下,但还是无法ls查看目录内容
    ls: 无法打开目录.: 权限不够
    [centos3@localhost xiangjis]$

  • 演示结论
    回答:
    可以不能修改文件的内容,因为对文件没有写权限
    可以删除该文件,因为对目录有写的权限,且可以在该目录下创建文件

  1. 对目录有写权限,可以在该目录下创建和删除文件,不能修改文件,此取决与对文件是否有写的权限
  2. 要想ls查看目录下的内容,须对目录同时拥有r和x的权限
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 158,847评论 4 362
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 67,208评论 1 292
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 108,587评论 0 243
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 43,942评论 0 205
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 52,332评论 3 287
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,587评论 1 218
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,853评论 2 312
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,568评论 0 198
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,273评论 1 242
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,542评论 2 246
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 32,033评论 1 260
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,373评论 2 253
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 33,031评论 3 236
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,073评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,830评论 0 195
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,628评论 2 274
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,537评论 2 269

推荐阅读更多精彩内容