gyx is not in the sudoers file.  This incident will be reported.

1.切换到root用户 su ,如果想要切换回去 exit

2.添加sudo文件的写权限,命令是:
chmod u+w /etc/sudoers

3.编辑sudoers文件
vi /etc/sudoers
找到这行 root ALL=(ALL) ALL,在他下面添加xxx ALL=(ALL) ALL (这里的xxx是你的用户名)

ps:这里说下你可以sudoers添加下面四行中任意一条
youuser            ALL=(ALL)                ALL
%youuser           ALL=(ALL)                ALL
youuser            ALL=(ALL)                NOPASSWD: ALL
%youuser           ALL=(ALL)                NOPASSWD: ALL

第一行:允许用户youuser执行sudo命令(需要输入密码).
第二行:允许用户组youuser里面的用户执行sudo命令(需要输入密码).
第三行:允许用户youuser执行sudo命令,并且在执行的时候不输入密码.
第四行:允许用户组youuser里面的用户执行sudo命令,并且在执行的时候不输入密码.

4.撤销sudoers文件写权限,命令:
chmod u-w /etc/sudoers

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-19
  • 2021-07-26
  • 2021-11-18
  • 2021-11-17
  • 2021-07-17
猜你喜欢
  • 2022-12-23
  • 2021-12-24
  • 2021-08-19
  • 2021-12-02
  • 2022-12-23
  • 2021-12-09
  • 2021-11-17
相关资源
相似解决方案