XXX is not in the sudoers file. This incident will be reported 解决方法
问题提出:
ubuntu终端情况,在普通用户登录时 使用命令 sudo -s 切换到root失败,提示:
XXX is not in the sudoers file. This incident will be reported.
解决方法:
首先需要切换到root身份:1)要么知道root用户密码;
su root 或 su 或 su -
(注意有- ,这和su是不同的,在用命令"su"的时候只是切换到root,但没有把root的环境变量传过去,
还是当前用户的环境变量,用"su -"命令将环境变量也一起带过去,就象和root登录一样)
2)要么通过root授权了的用户切换到root用户
例如ubuntu用户被授予了获取root权限,那么可以先切换到ubuntu用户下再,使用sudo -s命令,输入ubuntu用户的密码
切换到root之后,编辑/etc/sudoers文件:vim /etc/sudoers打开之后
在末尾新增一行:
username ALL=(ALL) ALL
这里的username代表你要被授予root权限的用户名
或者使用visudo命令直接编辑/etc/sudoers文件
问题提出:
ubuntu终端情况,在普通用户登录时 使用命令 sudo -s 切换到root失败,提示:
XXX is not in the sudoers file. This incident will be reported.
解决方法:
首先需要切换到root身份:1)要么知道root用户密码;
su root 或 su 或 su -
(注意有- ,这和su是不同的,在用命令"su"的时候只是切换到root,但没有把root的环境变量传过去,
还是当前用户的环境变量,用"su -"命令将环境变量也一起带过去,就象和root登录一样)
2)要么通过root授权了的用户切换到root用户
例如ubuntu用户被授予了获取root权限,那么可以先切换到ubuntu用户下再,使用sudo -s命令,输入ubuntu用户的密码
切换到root之后,编辑/etc/sudoers文件:vim /etc/sudoers打开之后
在末尾新增一行:
username ALL=(ALL) ALL
这里的username代表你要被授予root权限的用户名
或者使用visudo命令直接编辑/etc/sudoers文件