0

I'm afraid I locked myself out of the sudo/root options. The one account that had sudo rights now reports that it doesn't have these anymore. How can I restore this? Do I need to use a live stick?

SPRBRN
  • 2,315
  • 6
  • 28
  • 35
  • What errors occur? – Wilf Feb 28 '15 at 16:19
  • 3
    See http://askubuntu.com/questions/487003/reset-administrative-forgotten-password If that link does not solve your problem we need more information. Simply stating it is broken is insufficient. What command are you running ? what error message ? what did you to to get this result (chmod -R 777 / , chown -R user:user /, usermod ?) ? Could be most anything. – Panther Feb 28 '15 at 16:26
  • Did you set your root password after installation? – Ankit Singhaniya Feb 28 '15 at 17:26
  • The duplicate link was an almost exact copy of my situation. Thanks for the tips! – SPRBRN Mar 01 '15 at 12:44

2 Answers2

0
  1. Drop into the root shell as described here.
  2. Change the root password by giving the command passwd root
  3. Change the passwords of the other users by the command passwd username
Naveen
  • 9,365
  • 11
  • 43
  • 70
0

No sudo rights for your user can be caused due to multiple reasons.

I suggest trying Naveen's answer first, but in some cases dropping to the root shell doesn't work (for instance, you get the message "Give root password for maintenance").

In the latter case, you should try booting an Ubuntu Live CD, and mount the partition that contains your Ubuntu filesystem and you should chroot to your root filesystem.

In the case your user isn't part anymore of the sudo group (you can check this by issuing groups <username> from your terminal), you'll have to re-add your user to the sudo group:

adduser <username> sudo,

Also make sure the /etc/sudoers file contains the following entry for the sudo group:

%sudo ALL=(ALL:ALL) ALL

This website shows the first part of this procedure in more detail

Zebaz
  • 156
  • you can still do this from root shell even mounting / check the link in a comment posted by bodhi.zazen it works. – JoKeR Feb 28 '15 at 17:19