1.切换到root用户
[[email protected] 桌面]$ su -
密码:
[[email protected] ~]# ll /etc/sudoers
-r--r-----. 1 root root 4038 6月 29 10:17 /etc/sudoers
2.修改/etc/suoders权限为可写
[[email protected] ~]# chmod 777 /etc/sudoers
查看文件权限,颜色变为绿色
[[email protected] ~]# ls -l /etc/sudoers
-rwxrwxrwx. 1 root root 4038 6月 29 10:17 /etc/sudoers
3.编辑修改/etc/sudoers文件
[[email protected] ~]# gedit /etc/sudoers
TZ ALL=(ALL) NOPASSWD: ALL
4.保存退出并恢复/etc/sudoers的访问权限为440
[[email protected] ~]# chmod 440 /etc/sudoers
[[email protected] ~]# ls -l /etc/sudoers
-r--r-----. 1 root root 4038 6月 29 10:17 /etc/sudoers
5.然后重启即可
时间: 2024-11-06 02:16:58