1.切换超级用户权限 su

为用户添加sudo:

编辑/etc/sudoers 文件

2.添加文件写权限。 chmod u+w /etc/sudoers

3.编辑/etc/sudoers,增加一行如下: 用户名 ALL=(ALL) ALL,保存退出

  *免密码:用户名 ALL=(ALL) NOPASSWD: ALL

4.撤销写权限。chmod u-w /etc/sudoers

退出超级用户即可使用sudo

相关文章:

猜你喜欢
相关资源
相似解决方案