This question already has an answer here:

My user is removed from the sudoers file. I don't how it got removed because i only have access to my machine. I tried accessing the sudoers file but it mentions my username and asks the password for it like "[sudo] password for arunn:". But it doesn't accepts the password which i normally use to login to my machine and i hve no problem in it. The problem is when i try to use sudo and gives the error when i give the password and the error message as follows "arunn is not in the sudoers file. This incident will be reported". Also i recently added my user name to my virtualbox and will that be the problem ? Please i'm in terriblle situation so help please !

marked as duplicate by Warren Hill, chaos, muru, Eric Carvalho, Eliah Kagan Aug 16 '14 at 5:49

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


You can use pkexec even if you are not in sudoers. Do:

pkexec visudo

and add back an entry for your username. pkexec will accept your password since PolicyKit authorization is configured elsewhere, and is probably untouched by whatever messed with sudoers.

  • I suspect this won't work. Ubuntu's default config gives both sudo and polkit based powers to sudo group members (or admin group, in old versions of Ubuntu). Unless sudoers was also edited to remove the rule about that group, most likely the OP here has simply lost membership in the sudo group. And in that case, pkexec won't grant access. On the other hand, if the OP is not a member of those groups but just had a user line in sudoers, then (since, as you say, sudoers doesn't confer polkit powers) they probably cannot and never could run commands as root with pkexec. – Eliah Kagan Aug 16 '14 at 5:49
  • @EliahKagan Hmmm. When he says he added his username to VirtualBox, perhaps he was adding his user to a group and forgot to add the append flag to usermod, instead of using adduser? True. Should I delete this answer? – muru Aug 16 '14 at 6:47
  • Actually you might want to keep this answer around. If this question's duplicate status is correct, I think this answer will most likely not help. But if the duplicate status is not correct and fixing this isn't a matter of adding the user to a group... then this answer might help, or point the OP in the right direction. – Eliah Kagan Aug 16 '14 at 7:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.