Score:0

incorrectly edited the /etc/sudoers file and lost sudo priviledges

es flag

While trying to figure out why another user doesn't have sudo privileges I got rid of % in %sudo ALL=(ALL:ALL) ALL and after doing I myself cannot lost sudo access. I get the message "xxxx is not in the sudoers file. This incident will be reported." When I do su, I get "su: Authentication failure" which means (based on googling) the root account is disabled. Any ideas on how to fix this? I also cannot run pkexec visudo as it says "Error executing command as another user: Not authorized". So any suggestions on how to fix this are appreciated. I am using Ubuntu 22.04 Unfortunately none of the solutions listed at How to modify an invalid '/etc/sudoers' file? worked for me

Many thanks

guiverc avatar
cn flag
If you had a *root* account *enabled*, your chance will **not** have impacted that at all, ie. you can login as root & correct the issue. The root login is *disabled* however for on-topic Ubuntu systems by default (*don't forget there is a specific command to edit the sudoers files, that checks for errors before you exit; as any errors get treated as an end-of-file*) You didn't provide release, so we're limited to being *generic* in replies.
guiverc avatar
cn flag
The easiest fix I'd likely use is booting *live* media, manually navigating to the file & correcting from there. You didn't specify if you're talking Ubuntu 22.04 LTS Server, Ubuntu 22.04 LTS Desktop, but you can use whatever 22.04 media your machine is capable of booting & using.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.