ACL权限练习

1. 在/testdir/dir里创建的新文件自动属于webs组,
  组apps的成员如:tomcat能对这些新文件有读写权限,
  组dbs的成员如:mysql只能对新文件有读权限,
  其它用户(不属于webs,apps,dbs)不能访问这个文件夹.
 mkdir /testdir/dir
 chown  .webs /testdir/dir
 setfacl -m g:apps:rw- /testdir/dir
 setfacl -m g:dbs:r-- /testdir/dir
 setfacl -m g::--- /testdir/dir
2. 误将 /bin/chmod 文件的执行权限删除,如何恢复?
例子: 
  root@Centos8 dir]# ll /bin/chmod

  ----------. 1 root root 76904 May 12 2019 /bin/chmod

  [root@Centos8 dir]# chmod 755 /bin/chmod

  -bash: /usr/bin/chmod: Permission denied

解决:两种办法,一种是直接把root用户设置ACL权限,另外一种是将root组设置ACL权限。

 [root@Centos8 dir]# setfacl -m u:root:rwx /bin/chmod

 [root@Centos8 dir]# chmod 755 /bin/chmod

 [root@Centos8 dir]# ll /bin/chmod

    -rwxr-xr-x+ 1 root root 76904 May 12 2019 /bin/chmod

 [root@Centos8 dir]# setfacl -b /bin/chmod

 [root@Centos8 dir]# chmod 755 /bin/chmod

 [root@Centos8 dir]# ll /bin/chmod

 -rwxr-xr-x. 1 root root 76904 May 12 2019 /bin/chmod

原文地址:https://www.cnblogs.com/huangguangrui/p/12762140.html