解决方法
1、登录root
su --login
2、 进入etc 文件夹
cd /etc
3、 修改sudoers文件为可读可写
chmod +777 sudoers
4 、修改sudoers 文本
vi sudoers
按i 插入找到下面一行内容添加 “wang ALL=(ALL) ALL”
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
wang ALL=(ALL) ALL ##这个是我本机账户添加
按“Esc”键退出插入模式
输入
:eq
按回车退出。
5、权限修改为440
chmod 440 sudoers
6、退出
exit
历史命令
[root@localhost ~]# history
1 cd /etc
2 ls
3 cd …
4 exit
5 cd /etc
6 ll
7 ll |grep sudoers
8 chomd +777 sudoers
9 chmod +777 sudoers
10 ll |grep sudoers
11 vi sudoers
12 chmod 440 sudoers
13 ll |grep sudoers
14 exit
15 history
[root@localhost ~]#