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

相关文章:

  • 2022-02-11
  • 2021-05-31
  • 2021-06-02
  • 2022-12-23
  • 2021-06-29
  • 2022-12-23
  • 2021-10-09
  • 2021-06-14
猜你喜欢
  • 2021-12-17
  • 2022-02-16
  • 2021-12-23
相关资源
相似解决方案