六、Linux系统中的权限管理

六、Linux系统中的权限管理

1.权限查看及读取
1)权限查看
命令功能
ls -l file查看文件权限
ls -ld dir查看目录权限
2)权限读取

文件的属性被叫做文件的元数据,一种元数据用1个Byte来记录内容

#文件权限信息
 -     |  rw-r--r-- |   .    |  1   |  root  |  root  |  0  |  Oct 18 19:09 |   file1
[1]        [2]        [3]     [4]     [5]      [6]     [7]        [8]          [9]
#目录权限信息
d     |  rwxr-xr-x |   .    |  2   |  root  |  root  |  45  |  Oct 18 19:09 |   cheng
[1]        [2]        [3]     [4]     [5]      [6]     [7]        [8]          [9]
  • [1] 文件类型;
  • [2] 用户权限;
  • [3] 系统的selinux开启;
  • [4] 对于文件:文件内容被系统记录的次数;对于目录:目录中子目录的个数;
  • [5] 文件拥有者;
  • [6] 文件拥有组
  • [7]对于文件:文件内容大小;对于目录:目录中子文件的元数据大小。
标号含义
符号文件类型
-普通文件
d目录
l软连接
b块设备
c字符设备
ssocket套接字
p管道
2.文件用户、用户组管理
chown username file  #更改文件拥有者
chgrp groupname file  #更改文件拥有组
chown username:groupname file  #同时更改文件的拥有者和拥有组
chown | chgrp -R user|group dir  #同时更改目录本身及目录中内容的拥有者或者拥有组
[root@localhost ~]# cd /mnt/cheng
[root@localhost cheng]# mkdir chengdir{1..3}
[root@localhost cheng]# touch chengdir1/test{1..3}
[root@localhost cheng]# useradd zhangsan
[root@localhost cheng]# useradd lisi
[root@localhost cheng]# useradd dage
[root@localhost cheng]# chown zhangsan -R chengdir1
[root@localhost cheng]# chgrp lisi -R chengdir1
[root@localhost cheng]# touch chengdir2/test{1..3}
[root@localhost cheng]# chown -R dage:dage chengdir2

结果

3.普通权限的类型及作用
1)用户对文件的身份

u: # user 文件的拥有者,ls -l看到的第五列信息;
g: # group 文件拥有组,ls -l看到的第六列信息;
o: # other 既不是拥有者也不是拥有组成员的其他用户的通称。

2)权限位
rw-  | r--  |r --
  u      g     o
3)用户身份匹配

user > group >other

4)权限类型

- # 权限未开启;
r # 可读;
w # 可写;对文件:可以更改文件内容、对目录:可以在目录中新建或删除文件。
x # 可执行;对文件:可以用文件名称调用文件内记录的程序、对目录:可以进入目录中。

4.设定普通权限的方法

chmod# 设定文件权限

1)chmod 字符方式设定权限
chmod <u|g|o> <+|-|=> <r|w|x> file #chmod 字符方式设定权限
#eg.设定前
-rw-r--r--. 1 root     root   0 Oct 18 19:09 file1
-rw-r--r--. 1 root     root   0 Oct 18 19:09 file2
-rw-r--r--. 1 root     root   0 Oct 18 19:09 file3
[root@localhost cheng]# chmod u=rwx,g=rwx,o=rwx file{1..3}
-rwxrwxrwx. 1 root     root   0 Oct 18 19:09 file1
-rwxrwxrwx. 1 root     root   0 Oct 18 19:09 file2
-rwxrwxrwx. 1 root     root   0 Oct 18 19:09 file3
2)设定规则修改:rwx=111
#regular
---     000     0
r--     100     4
-w-     010     2
--x     001     1
-wx     011     3
r-x     101     5
rw-     110     6
rwx     111     7

ugo     640     rw-|r--|---

000     0
001     1
010     2
011     3
100     4
101     5
110     6
111     7

#修改前
/mnt/cheng/chengdir2:
total 0
-rw-r--r--. 1 dage dage 0 Oct 19 00:18 test1
-rwxrwxrwx. 1 dage dage 0 Oct 19 00:18 test2
-rw-r--r--. 1 dage dage 0 Oct 19 00:18 test3

[root@localhost cheng]# chmod 777 chengdir2/test2
[root@localhost cheng]# chmod 000 chengdir2/test1
[root@localhost cheng]# chmod 101 chengdir2/test3
#结果
/mnt/cheng/chengdir2:
total 0
----------. 1 dage dage 0 Oct 19 00:18 test1
-rwxrwxrwx. 1 dage dage 0 Oct 19 00:18 test2
---x-----x. 1 dage dage 0 Oct 19 00:18 test3
3)复制权限

chmod --reference=chengdir2 chengdir1 #复制chengdir2目录的权限到chengdir1
chmod -R --reference=chengdir2 chengdir1 #复制chengdir2目录的权限到chengdir1及文件中,-R表示递归操作

#chmod的复制权限
#1.实验前
drwxr-xr-x. 2 zhangsan lisi  45 Oct 19 00:16 chengdir1
d--x-----x. 2 dage     dage  45 Oct 19 00:18 chengdir2
drwxr-xr-x. 2 root     root   6 Oct 19 00:15 chengdir3

[root@localhost cheng]# chmod --reference=chengdir2 chengdir1

#1.实验后
d--x-----x. 2 zhangsan lisi  45 Oct 19 00:16 chengdir1
d--x-----x. 2 dage     dage  45 Oct 19 00:18 chengdir2
drwxr-xr-x. 2 root     root   6 Oct 19 00:15 chengdir3

#2.实验前
/mnt/cheng:
total 8
d--x-----x. 2 zhangsan lisi  45 Oct 19 00:16 chengdir1
d--x-----x. 2 dage     dage  45 Oct 19 00:18 chengdir2
/mnt/cheng/chengdir1:
total 0
-rw-r--r--. 1 zhangsan lisi 0 Oct 19 00:16 test1
-rw-r--r--. 1 zhangsan lisi 0 Oct 19 00:16 test2
-rw-r--r--. 1 zhangsan lisi 0 Oct 19 00:16 test3

[root@localhost cheng]# chmod -R --reference=chengdir2 chengdir1

#2.实验后
/mnt/cheng/chengdir1:
total 0
---x-----x. 1 zhangsan lisi 0 Oct 19 00:16 test1
---x-----x. 1 zhangsan lisi 0 Oct 19 00:16 test2
---x-----x. 1 zhangsan lisi 0 Oct 19 00:16 test3
5.系统默认权限设定
  • 系统本身存在的意义共享资源;
  • 从安全角度讲系统共享的资源越少,开放的权力越小,系统安全性越高;
  • 既要保证系统的安全,又要系统创造价值,把应该开放的权力默认开放;
  • 把不安全的权力默认保留。
1)保留权力
 #umask表示系统保留权力
 [root@localhost cheng]# umask   #查看系统保留权力
0022
[root@localhost cheng]# umask 077   #临时设定系统默认权力
[root@localhost cheng]# umask
0077

文件默认权限 = 777 - umask - 111
777 - 022 - 111 = 755 - 111 = 644 =110 |100 |100 = rw-|r–|r–
目录默认权限 = 777 - umask
777 - 022 = 755 = 111 | 101 | 101 = rwx | r-x |r-x
umask值越大系统安全性越高

(1)临时更改umask :

umask 077

(2)永久更改:

vim /etc/bashrc #shell系统配置文件

[root@localhost cheng]# vim /etc/bashrc
[root@localhost cheng]# vim /etc/profile
[root@localhost cheng]# source /etc/bashrc  #source作用时使更改的内容立即被系统识别
[root@localhost cheng]# source /etc/profile
  if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
       umask 002  #普通用户的umask
    else
       umask 022 ---->077   #root用户的umask
    fi

vim /etc/profile #系统环境配置文件

if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
    umask 002   #普通用户的umask
else
    umask 022 ------>  077   #root用户的umask
fi
2)选择保留权力
(1)粘制位

stickyid # 粘制位,针对目录:如果一个目录stickyid开启,那么这个目录中的文件只能被文件所有人删除

chmod 1原始权限(1777) dir
chmod o+t dir
#实验:
[root@localhost ~]# chmod 777 /mnt/cheng
[root@localhost ~]# su - zhangsan 
Last login: Tue Oct 20 18:46:49 PDT 2020 on pts/0
[zhangsan@localhost ~]$ touch /mnt/cheng/file2
[zhangsan@localhost ~]$ exit
logout
[root@localhost ~]# su - wangwu
Last login: Tue Oct 20 18:48:16 PDT 2020 on pts/1
[wangwu@localhost ~]$ touch /mnt/cheng/file3

/mnt/:
total 0
drwxrwxrwx. 2 root root 32 Oct 20 18:52 cheng
drwxr-xr-x. 2 root root  6 Oct 18 18:56 hgfs
/mnt/cheng:
total 0
-rw-rw-r--. 1 jiangjiang jiangjiang 0 Oct 20 18:50 file1
-rw-rw-r--. 1 zhangsan zhangsan 0 Oct 20 18:50 file2
-rw-rw-r--. 1 wangwu   wangwu   0 Oct 20 18:51 file3

[wangwu@localhost ~]$ rm -fr /mnt/cheng/file1 #未开启粘制位前删除其他用户创建的文件
/mnt/cheng:
total 0
-rw-rw-r--. 1 zhangsan zhangsan 0 Oct 20 18:50 file2
-rw-rw-r--. 1 wangwu   wangwu   0 Oct 20 18:51 file3



[root@localhost ~]# chmod o+t /mnt/cheng #开启粘制位
[root@localhost ~]# su - wangwu
Last login: Tue Oct 20 18:50:57 PDT 2020 on pts/1
[wangwu@localhost ~]$ rm -fr /mnt/cheng/file2
rm: cannot remove '/mnt/cheng/file2': Operation not permitted

/mnt/:
total 0
drwxrwxrwt. 2 root root 32 Oct 20 18:52 cheng
drwxr-xr-x. 2 root root  6 Oct 18 18:56 hgfs
/mnt/cheng:
total 0
-rw-rw-r--. 1 jiangjiang jiangjiang 0 Oct 20 18:50 file1
-rw-rw-r--. 1 zhangsan zhangsan 0 Oct 20 18:50 file2
-rw-rw-r--. 1 wangwu   wangwu   0 Oct 20 18:51 file3
(2)强制位-gid

sgid # 强制位,针对目录:目录中新建的文件自动归属到目录的所属组中

chmod 2原始权限(1777) dir
chmod g+s dir
#实验
[root@localhost ~]# su - jiangjiang
Last login: Tue Oct 20 18:39:25 PDT 2020 on tty2
[jiangjiang@localhost ~]$ mkdir /mnt/cheng/haha
[jiangjiang@localhost ~]$ exit
logout
[root@localhost ~]# chmod g+s /mnt/cheng/
[root@localhost ~]# su - jiangjiang
Last login: Tue Oct 20 18:59:44 PDT 2020 on pts/1
[jiangjiang@localhost ~]$ mkdir /mnt/cheng/xixi

#结果
/mnt/:
total 0
drwxrwsrwx. 4 root root 56 Oct 20 19:01 cheng
drwxr-xr-x. 2 root root  6 Oct 18 18:56 hgfs

/mnt/cheng:
total 0
-rw-rw-r--. 1 zhangsan   zhangsan   0 Oct 20 18:50 file2
-rw-rw-r--. 1 wangwu     wangwu     0 Oct 20 18:51 file3
drwxrwxr-x. 2 jiangjiang jiangjiang 6 Oct 20 19:00 haha #jiangjaing建立的目录组为jiangjiang 
drwxrwsr-x. 2 jiangjiang root       6 Oct 20 19:01 xixi #开启粘制位后jiangjiang建立的目录为目录所在组root

(3)强制位-uid

suid # 强制位,只针对二进制的可执行文件(c程序),当运行二进制可执行文件时,都是用文件拥有人身份运行,和执行用户无关

chmod 4原始权限(1777) dir
chmod u+s dir
#实验
#1
[jiangjiang@localhost ~]$ /bin/cat


[root@localhost /]# ps ax -o user,group,command | grep cat
gdm      gdm      /usr/libexec/gsd-print-notifications
jiangji+ jiangji+ /usr/libexec/gsd-print-notifications
jiangji+ jiangji+ /usr/bin/gnome-software --gapplication-service
jiangji+ jiangji+ /bin/cat #开启g+s之前使用运行文件的用户组身份
root     root     grep --color=auto cat
[root@localhost /]# ll /bin/cat
-rwxr-xr-x. 1 root root 51856 Jan 11  2019 /bin/cat
[root@localhost /]# chmod g+s /bin/cat ####   开启gid
[root@localhost /]# ll /bin/cat
-rwxr-sr-x. 1 root root 51856 Jan 11  2019 /bin/cat

#2
[jiangjiang@localhost ~]$ /bin/cat

[root@localhost /]# ps ax -o user,group,command | grep cat
gdm      gdm      /usr/libexec/gsd-print-notifications
jiangji+ jiangji+ /usr/libexec/gsd-print-notifications
jiangji+ jiangji+ /usr/bin/gnome-software --gapplication-service
jiangji+ root     /bin/cat #开启gid之后,文件以文件拥有组身份运行
root     root     grep --color=auto cat
[root@localhost /]# chmod u+s /bin/cat ####   开启uid
[root@localhost /]# ll /bin/cat
-rwsr-sr-x. 1 root root 51856 Jan 11  2019 /bin/cat

#3
[jiangjiang@localhost ~]$ /bin/cat


[root@localhost /]# ps ax -o user,group,command | grep cat
gdm      gdm      /usr/libexec/gsd-print-notifications
jiangji+ jiangji+ /usr/libexec/gsd-print-notifications
jiangji+ jiangji+ /usr/bin/gnome-software --gapplication-service
root     root     /bin/cat  #开启uid之后,文件以文件拥有人身份运行
root     root     grep --color=auto cat

修改文件权限,文件风险级别改变:

6.acl权限列表
1)acl:访问控制列表

Aiccess Control Lists # 访问控制列表
功能:在列表中可以设定特殊用户对与特殊文件有特殊权限

#acl列表开启标识
-rw-rw-r--+ 1 zhangsan   zhangsan   0 Oct 20 18:50 file2
#有加号表示acl列表开启
-rw-rw-r--. 1 wangwu     wangwu     0 Oct 20 18:51 file3
#没有加号表示acl列表未开启
命令功能
getfacl filenameacl列表权限读取
setfacl -m u:username:权限 filename用户acl权限设定
setfacl -m g:groupname:权限 filename组acl权限设定
setfacl -x u:username filename删除列表中的用户
setfacl -b filename关闭
#实验:
#修改用户acl权限
[root@localhost cheng]# getfacl file1
getfacl: file1: No such file or directory
[root@localhost cheng]# setfacl -m u:zhangsan:0 /mnt/cheng/file2
[root@localhost cheng]# getfacl /mnt/cheng/file2
getfacl: Removing leading '/' from absolute path names
# file: mnt/cheng/file2
# owner: zhangsan
# group: zhangsan
user::rw-
user:zhangsan:---
group::rw-
mask::rw-
other::r--

/mnt/cheng:
total 0
-rw-rw-r--+ 1 zhangsan   zhangsan   0 Oct 20 18:50 file2
-rw-rw-r--. 1 wangwu     wangwu     0 Oct 20 18:51 file3
drwxrwxr-x. 2 jiangjiang jiangjiang 6 Oct 20 19:00 haha
drwxrwsr-x. 2 jiangjiang root       6 Oct 20 19:01 xixi
##修改组acl权限
[root@localhost cheng]# setfacl -m g:group1:0 /mnt/cheng/
[root@localhost cheng]# getfacl /mnt/cheng
getfacl: Removing leading '/' from absolute path names
# file: mnt/cheng
# owner: root
# group: root
user::rwx
group::rwx
group:group1:---
mask::rwx
other::rwx
2) acl权限优先级

拥有者 > 特殊指定用户 > 权限多的组 > 权限少的组 > 其他

3)acl mask控制

mask能够赋予指定用户权限的最大阙值
当设定完毕文件的acl列表之后,用chmod缩小了文件拥有组的权力,mask值会变化
恢复:setfacl -m m:权限 filename

4)acl列表的默认权限
setfacl -m u:zhangsan:rwx /mnt/cheng   #只对于/mnt/cheng目录本身生效
setfacl -Rm u:zhangsan:rwx /mnt/cheng   #对于/mnt/cheng目录和目录中已经存在的内容生效
####以上命令只针对于存在的文件生效,新建文件是不会被设定的
setfacl -m d:u:zhangsan:rwx /mnt/cheng  #针对于/mnt/cheng目录中新建文件生效
#实验前
/mnt/:
total 0
drwxrwxrwx. 2 root root 45 Oct 20 23:14 cheng

/mnt/cheng:
total 0
-rw-r--r--. 1 root root 0 Oct 20 23:14 file1
-rw-r--r--. 1 root root 0 Oct 20 23:14 file2
-rw-r--r--. 1 root root 0 Oct 20 23:14 file3

#1[root@localhost cheng]# setfacl -m u:zhangsan:rwx /mnt/cheng  ##只对于/mnt/cheng目录本身生效

/mnt/:
total 0
drwxrwxrwx+ 2 root root 45 Oct 20 23:14 cheng #+表示对zhangsan/mnt/cheng是可rwx的
/mnt/cheng:
total 0
-rw-r--r--. 1 root root 0 Oct 20 23:14 file1
-rw-r--r--. 1 root root 0 Oct 20 23:14 file2
-rw-r--r--. 1 root root 0 Oct 20 23:14 file3
#2[root@localhost cheng]# setfacl -Rm u:zhangsan:rwx /mnt/cheng #对于/mnt/cheng目录和目录中已经存在的内容生效

/mnt/:
total 0
drwxrwxrwx+ 2 root root 45 Oct 20 23:14 cheng
/mnt/cheng:
total 0
-rw-rwxr--+ 1 root root 0 Oct 20 23:14 file1
-rw-rwxr--+ 1 root root 0 Oct 20 23:14 file2
-rw-rwxr--+ 1 root root 0 Oct 20 23:14 file3
#3[root@localhost cheng]# touch file4
[root@localhost cheng]# setfacl -m d:u:zhangsan:rwx /mnt/cheng  #针对于/mnt/cheng目录中新建文件生效
[root@localhost cheng]# touch file5

/mnt/cheng:
total 0
-rw-rwxr--+ 1 root root 0 Oct 20 23:14 file1
-rw-rwxr--+ 1 root root 0 Oct 20 23:14 file2
-rw-rwxr--+ 1 root root 0 Oct 20 23:14 file3
-rw-r--r--. 1 root root 0 Oct 20 23:33 file4  #新建文件不生效
-rw-rw-rw-+ 1 root root 0 Oct 20 23:33 file5  #运行代码对新建文件生效

7.attr权限

attr权限限制所有用户

  • i :不能做任何修改
  • a:能添加不能删除
命令功能
lsattr dir/file查看attr权限
chattr +i/+a/-i/-a dir/file设定attr权限
#实验
#1)能添加不能删除
[root@localhost cheng]# touch file2
[root@localhost cheng]# ls
file1  file2
[root@localhost cheng]# rm -rf file1
[root@localhost cheng]# ls
file2
[root@localhost cheng]# chattr +a /mnt/cheng
[root@localhost cheng]# rm -rf file2
rm: cannot remove 'file2': Operation not permitted
[root@localhost cheng]# lsattr /mnt/cheng -d
-----a------------ /mnt/cheng
[root@localhost cheng]# chattr -a /mnt/cheng
[root@localhost cheng]# lsattr /mnt/cheng -d
------------------ /mnt/cheng
[root@localhost cheng]# rm -rf file2
[root@localhost cheng]# ls
[root@localhost cheng]# 
 
#2)不能做任何修改
[root@localhost cheng]# ls
file1  file2  file3
[root@localhost cheng]# chattr +i /mnt/cheng
[root@localhost cheng]# lsattr /mnt/cheng -d
----i------------- /mnt/cheng
[root@localhost cheng]# touch file5
touch: setting times of 'file5': No such file or directory
[root@localhost cheng]# rm -fr file1
rm: cannot remove 'file1': Operation not permitted

练习
练习

#解1
[root@localhost cheng]# groupadd -g 8000 shengchan
[root@localhost cheng]# groupadd -g 8001 caiwu
[root@localhost cheng]# groupadd -g 8002 jishu
#解2
[root@localhost cheng]# useradd -G shengchan,jishu westosuser
[root@localhost cheng]# useradd -g caiwu -u 8001 -G jishu lee
[root@localhost cheng]# useradd linux /sbin/nologin
[root@localhost cheng]# useradd  /sbin/nologin linux
[root@localhost cheng]# useradd -s  /sbin/nologin linux
[root@localhost cheng]# useradd westosadmin
[root@localhost cheng]# westosadmin:x:0:0::/home/westosadmin:/bin/bash
#解3
[root@localhost cheng]# echo westos | passwd --stdin westosuser
[root@localhost cheng]# echo westos | passwd --stdin lee
[root@localhost cheng]# echo westos | passwd --stdin linux
[root@localhost cheng]# echo westos | passwd --stdin westosadmin
[root@localhost cheng]# passwd -e westosuser
[root@localhost cheng]# passwd -e lee
[root@localhost cheng]# passwd -e linux
[root@localhost cheng]# passwd -e westosadmin
[root@localhost cheng]# passwd -x 30 -w 2 westosuser
[root@localhost cheng]# passwd -x 30 -w 2 lww
[root@localhost cheng]# passwd -x 30 -w 2 lee
[root@localhost cheng]# passwd -x 30 -w 2 linux
[root@localhost cheng]# passwd -x 30 -w 2 westosadmin
#结果
==> /etc/group <==
dip:x:40:
tcpdump:x:72:
jiangjiang:x:1000:
zhangsan:x:1001:
shengchan:x:8000:westosuser
caiwu:x:8001:
jishu:x:8002:westosuser,lee
westosuser:x:8003:
linux:x:8004:
westosadmin:x:8005:

==> /etc/passwd <==
gnome-initial-setup:x:978:976::/run/gnome-initial-setup/:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
insights:x:977:975:Red Hat Insights:/var/lib/insights:/sbin/nologin
avahi:x:70:70:Avahi mDNS/DNS-SD Stack:/var/run/avahi-daemon:/sbin/nologin
tcpdump:x:72:72::/:/sbin/nologin
jiangjiang:x:1000:1000:jiangjiang,,,,:/home/jiangjiang:/bin/bash
westosuser:x:1001:8003::/home/westosuser:/bin/bash
lee:x:8001:8001::/home/lee:/bin/bash
linux:x:8002:8004::/home/linux:/sbin/nologin

#解4
[root@localhost cheng]# mkdir sc
[root@localhost cheng]# mkdir js
[root@localhost cheng]# mkdir cw
[root@localhost cheng]# mkdir pub

[root@localhost Desktop]# chgrp shengchan cheng/sc
[root@localhost Desktop]# chgrp caiwu cheng/cw
[root@localhost Desktop]# chgrp jishu cheng/js
[root@localhost Desktop]# chmod g+s cheng/cw
[root@localhost Desktop]# chmod g+s cheng/js
[root@localhost Desktop]# chmod g+s cheng/sc
#结果
/home/jiangjiang/Desktop/cheng:
total 0
drwxrwsr-x+ 2 jiangjiang caiwu      19 Oct 21 00:49 cw
drwxrwsr-x+ 2 jiangjiang jishu      19 Oct 21 00:50 js
drwxrwxrwt+ 2 jiangjiang jiangjiang  6 Oct 21 00:32 pub
drwxrwsr-x+ 2 jiangjiang shengchan  19 Oct 21 00:49 sc

[root@localhost Desktop]# touch file1 cheng/sc
[root@localhost Desktop]# rm -fr file1
[root@localhost Desktop]# cd cheng
[root@localhost cheng]# ls
cw  js  pub  sc
[root@localhost cheng]# touch file1 /sc
[root@localhost cheng]# rm -rf  file1 /sc
[root@localhost cheng]# touch sc/file1
[root@localhost cheng]# touch cw/file2
[root@localhost cheng]# touch js/file3
[root@localhost cheng]# chmod 777 pub #全操作
[root@localhost cheng]# chmod o+t pub #只能删除文件所有人创建的文件
[root@localhost cheng]# setfacl -m u:westosadmin:rwx sc  #westosuser可以对sc内容进行全部操作
[root@localhost cheng]# setfacl -m u:westosadmin:rwx cw
[root@localhost cheng]# setfacl -m u:westosadmin:rwx js
[root@localhost cheng]# setfacl -m u:westosadmin:rwx pub
#结果
/home/jiangjiang/Desktop/cheng:
total 0
drwxrwsr-x+ 2 jiangjiang caiwu      19 Oct 21 00:49 cw
drwxrwsr-x+ 2 jiangjiang jishu      19 Oct 21 00:50 js
drwxrwxrwt+ 2 jiangjiang jiangjiang  6 Oct 21 00:32 pub
drwxrwsr-x+ 2 jiangjiang shengchan  19 Oct 21 00:49 sc

/home/jiangjiang/Desktop/cheng/cw:
total 0
-rw-r--r--. 1 root caiwu 0 Oct 21 00:49 file2

/home/jiangjiang/Desktop/cheng/js:
total 0
-rw-r--r--. 1 root jishu 0 Oct 21 00:50 file3

/home/jiangjiang/Desktop/cheng/pub:
total 0

/home/jiangjiang/Desktop/cheng/sc:
total 0
-rw-r--r--. 1 root shengchan 0 Oct 21 00:49 file1
##验证
[root@localhost cheng]# getfacl sc
# file: sc
# owner: jiangjiang
# group: shengchan
# flags: -s-
user::rwx
user:westosadmin:rwx
group::rwx
mask::rwx
other::r-x

[root@localhost cheng]# getfacl cw
# file: cw
# owner: jiangjiang
# group: caiwu
# flags: -s-
user::rwx
user:westosadmin:rwx
group::rwx
mask::rwx
other::r-x






  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值