第二章部分笔记2018/4/23

[root@localhost ~]# whoami
root
[root@localhost ~]# useradd test3
[root@localhost ~]# usermod -aG wheel test3
[root@localhost ~]# echo "test3 ALL=(ALL) NOPASSWD: ALL" | tee /etc/sudoers.d/test3
test3 ALL=(ALL) NOPASSWD: ALL
[root@localhost ~]#
[root@localhost ~]# su - test3
[test3@localhost ~]$ whoami
test3
[test3@localhost ~]$ sudo useradd test4
[test3@localhost ~]$



  把chmod的全部执行权限去掉,问:怎么恢复回来?

        答:
                # chmod a-x /usr/bin/chmod

                # setfacl -m u:test:rwx /usr/bin/chmod
                # 由于/usr/bin/目录下的文件为系统默认命令文件,且全部是二进制文件
                        故:需要以管理员的身份更改
                # su - test
                $ sudo chmod a+x /usr/bin/chmod
~



# 恢复 setfacl 和 chmod 的执行权限(偏方)

        命令如下:
        #
        # chmod a-x /usr/bin/setfacl
        # chmod a-x /usr/bin/chmod

        解决办法:
        # cp /usr/bin/yum /usr/bin/chmod.bak   ---<找一个 带有执行权限的文件>

        # cat /usr/bin/chmod > /usr/bin/chmod.bak

        # ll /usr/bin/chmod*

        # mv /usr/bin/chmod /usr/bin/chmod.bak1
        # mv /usr/bin/chmod.bak /usr/bin/chmod

        # chmod a+x /usr/bin/setfacl

猜你喜欢

转载自blog.csdn.net/qq_42008023/article/details/80055079