Linux下is not in the sudoers file解决方法

221次阅读
没有评论

在新配备的服务器上,在使用非root账户进行sudo的时候会报如下的错 
当我们使用sudo命令切换用户的时候可能会遇到提示以下错误:xxx is not in the sudoers file. This incident will be reported,xxx是你当前的用户名,究其原因是用户没有加入到sudo的配置文件里

Linux下is not in the sudoers file解决方法

关于这个问题的解决方法如下:

  1. 切换到root用户,运行visudo命令
Linux下is not in the sudoers file解决方法
  1. 在打开的配置文件中,找到root ALL=(ALL) ALL,在下面添加一行xxx ALL=(ALL) ALL 其中xxx是你要加入的用户名称
Linux下is not in the sudoers file解决方法
  1. 输入:wq保存并退出配置文件,再次使用sudo命令就不会有上面的提示了。

设置如下规则,只允许wheel组su切root

auth required pam_wheel.so use_uid

Linux下is not in the sudoers file解决方法
正文完
 1
weldonwang
版权声明:本站原创文章,由 weldonwang 于2024-09-25发表,共计342字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
评论(没有评论)