用户名 is not in the sudoers file.This incident will be reported.解决方法

编程入门 行业动态 更新时间:2024-10-26 10:34:25

用户名 is not in the sudoers file.This incident will be reported.<a href=https://www.elefans.com/category/jswz/34/1770089.html style=解决方法"/>

用户名 is not in the sudoers file.This incident will be reported.解决方法

最近重新建了一个linux虚拟影像,过程出现以下问题,作出解决如下:

在使用终端安装时,系统提示“chen is not in the sudoers file”,这是因为该用户刚创立,尚未写入sudo权限。

解决方法如下:

su -

首先切换到root身份。终端输入'su -',然后输入用户密码,及创建主账户时所使用的密码。

("su"和"su -"是不同的,在用命令"su"的时候只是切换到root,但没有把root的环境变量传过去,还是当前用户的环境变量,用"su -"命令将环境变量也一起带过去,就象和root登录一样)

此时,用户已切换至root,执行

visudo

打开sudo配置文件,快捷键shift+g将光标移至最后一行,按a进入编写模式,输入

username ALL=(ALL) ALL

然后按esc键退出到命令模式,输入

wq!

保存退出

重新输入

su username

切换回使用用户,这时再输入sudo就不会弹出该提示。

 

更多推荐

用户名 is not in the sudoers file.This incident will be reported.解决方法

本文发布于:2024-02-26 08:41:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1701893.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:解决方法   用户名   sudoers   file   incident

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!