[已解决]user is not in the sudoers file. This incident will be reported.(简单不容易出错的方式)
linux Ubuntu中報錯,XXX is not in the sudoers file. This incident will be reported.
今天在學習的時候,不小心把自己的用戶sudo玩壞了(Broken sudo),于是上谷歌搜索XXX is not in the sudoers file. This incident will be reported.
看到一些大多數方法都是修改/etc/sudoers文件的內容,由于之前因為修改系統文件除了問題,進入recovery mode又把系統玩崩了(虛擬機),這次我就輕易不想修改系統文件
于是繼續看,查到了另一個方法是進入recovery mode修改https://www.tecmint.com/fix-user-is-not-in-the-sudoers-file-the-incident-will-be-reported-ubuntu/
可是我也更不想進入recovery 模式啊~
但我還是仔細的看完了介紹的步驟,繼續往下翻,看到許多評論都驚呼用這個方法解決了問題的時候
我再往下翻,看到了一個特別的評論:
簡單解釋下就是:
0、你的root需要設置好密碼
sudo passwd root
像這樣,我以一個新用戶user1為例:
1、設置好密碼之后,就可以切換到root用戶:
su root
這里root可以省略,默認就是切換root
像這樣
2、輸入如下指令,將用戶名添加到sudoers文件
sudo adduser image sudo
這里的image是我要恢復的用戶名,你應該輸入你想要恢復的用戶名,像這樣
3、su image(ctrl+d)切回到在使用的用戶
此時用戶image就被添加到了sudoers文件了,又可以使用sudo了:
使用sudo對用戶進行修改:
于是完成,congratulation!果然高手在民間,評論區還是要多逛逛~
總結
以上是生活随笔為你收集整理的[已解决]user is not in the sudoers file. This incident will be reported.(简单不容易出错的方式)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【Pytorch神经网络理论篇】 27
- 下一篇: logistic模型原理与推导过程分析(