误删除了chmod 执行权限怎么处理
原理:
root 用户通过chmod 命令给不同的文件访问者设置相应的权限,但root 用户不能执行对自己没有执行权限的文件
解决方式:
linux 中可通过ACL 权限让root 用户 为特定用户或用户组设置权限
#1.演示问题,删除chmod 的所有权限
[root@CentOS8 ~]#ll /bin/chmod
-rwxr-xr-x. 1 root root 76904 May 12 2019 /bin/chmod
[root@CentOS8 ~]#chmod 000 /bin/chmod
[root@CentOS8 ~]#ll /bin/chmod
----------. 1 root root 76904 May 12 2019 /bin/chmod
#2.通过ACL 权限给root 用户设置rwx 权限
[root@CentOS8 ~]#setfacl -m u:root:rwx /bin/chmod
[root@CentOS8 ~]#getfacl /bin/chmod
getfacl: Removing leading '/' from absolute path names
# file: bin/chmod
# owner: root
# group: root
user::---
user:root:rwx
group::---
mask::rwx
other::---
#3.通过chmod 命令给用户root 恢复原有权限
[root@CentOS8 ~]#chmod 755 /bin/chmod
[root@CentOS8 ~]#getfacl /bin/chmod
getfacl: Removing leading '/' from absolute path names
# file: bin/chmod
# owner: root
# group: root
user::rwx
user:root:rwx #effective:r-x
group::---
mask::r-x
other::r-x
#4.取消ACL 权限给root 用户设置的rwx 权限
[root@CentOS8 ~]#setfacl -b /bin/chmod
[root@CentOS8 ~]#getfacl /bin/chmod
getfacl: Removing leading '/' from absolute path names
# file: bin/chmod
# owner: root
# group: root
user::rwx
group::---
other::r-x