Help - Search - Members - Calendar
Full Version: Made myself regular user instead of superuser
Linuxhelp > Support > Technical Support
AshleyC
Hello,

I did a very stupid thing: I accidentally took my own rights away from my user (I use Ubuntu in Dutch, so I don't know the exact phrases) but before I changed it, I could install things, change users (obviously), and so on, all the things the superuser could do, and now I can't anymore.

Is it possible to get it right again without having to re-install ubuntu? I allready tried to login with the root-account, but that doesn't work: I get the message that the password or the login-name aren't correct. I don't really get how this is possible because I don't remember changing the root-password, so I thought it would be the same as my user. The name I have to use to login with the root is just "root", right?

Thanks anyway,
Ashley
arochester
Reboot and select 'recovery mode' from the grub menu then:
QUOTE
useradd -G admin <your account name>
this adds your account to the admin group, giving it sudo rights you can also edit the sudoers file directly, with:
QUOTE
visudo
You can't easily log into "root" because Ubuntu with sudo doesn't work that way.
AshleyC
Thanks for your help, I didn't know Ubunt worked like that. The useradd -G admin command doesn't work though. I've tried it 3 times now and it still doesn't work...
arochester
Then try the visudo option. I lost superuser status, through some kind of corruption and that is how I put it back.
AshleyC
QUOTE (arochester @ Feb 4 2008, 03:53 PM) *
Then try the visudo option. I lost superuser status, through some kind of corruption and that is how I put it back.


How did you do that exactly? I did something with the visudo, but I didn't really know what to do...
arochester
Copied from http://ubuntuforums.org/archive/index.php/t-150021.html

"Use the 'Recovery Mode from the Grub menu at startup.

Recovery mode will drop you to a root prompt. If you don't see the GRUB menu at startup then you probably have to press the ESC key to view it, as its sometimes hidden and only revealed when you hit the ESC key.

Once at the root prompt you can use this command to edit the /etc/sudoers file..

visudo #this command does on thing. It opens the sudoers file for editing

My sudoers file looks like this. Note the last line where I give my user sudo privileges. This is the line that would need to be added by those who, for whatever reason, don't have sudo privileges.

# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#

# Host alias specification

# User alias specification

# Cmnd alias specification

# Defaults

Defaults !lecture,tty_tickets,!fqdn

# User privilege specification
root ALL=(ALL) ALL
mustard ALL=(ALL) ALL


You can see my username on the bottom line. You would need to add your username to the bottom as I have done.

Assuming your user name was "bob'', then the line that would need to be added would be..
bob ALL=(ALL) ALL

This is just one way of doing it. Some sudoers files are set up with an admin group called 'adm'. Users are then added to the adm group, and a line in the sudoers file that looks like this below gives members of the 'adm' group admin access.
%adm ALL=(ALL) ALL

If you decided to do it this way you would create the line above at the bottom of your sudoers file then do this command (substituting your username in the appropriate place)..

adduser your_username adm"
AshleyC
Thank you so much! (It worked, and thanks to all this I learned a lot of things, although I have still a long way to go biggrin.gif)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.