配置用户具有root权限,方便后期加sudo执行root权限的命令
[root@master ~]# vim /etc/sudoers
修改/etc/sudoers文件,在%wheel这行下面添加一行,如下所示:
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
## Allows people in group wheel to run all commands
%wheel ALL=(ALL) ALL
用户名 ALL=(ALL) NOPASSWD:ALL
注意:用户名这一行不要直接放到root行下面,因为所有用户都属于wheel组,你先配置了用户名具有免密功能,但是程序执行到%wheel行时,该功能又被覆盖回需要密码。所以用户名要放到%wheel这行下面。