9

I have accidentally changed the root user from administrator type to basic type in the user account page, and now i have no whatever root previligaes on the system, how i can switch back to administrator type?

6
  • is it even possible?
    – green
    Apr 8, 2013 at 18:02
  • @green7 Yes, he didn't actually change the root user, he just changed the only normal account with admin privileges (so able to use sudo) to one without admin privileges (unable to use sudo). Apr 8, 2013 at 18:03
  • @green7 Although I do admit, the gui shouldn't really let you do that. Fair enough allowing removal from sudo using the command line, but the gui shouldn't allow a user to accidentally lock themselves out of making system changes. Apr 8, 2013 at 18:15
  • @green7 worst case you can fix these sorts of problems by booting an alternate OS and using a recovery/penetration tool to overwrite the existing accounts/permissions with new ones. Apr 8, 2013 at 19:04
  • @DanNeely I was thinking on similar lines. Probably just adding the username to /etc/group using a live CD would work?
    – green
    Apr 8, 2013 at 19:05

3 Answers 3

12

Assuming you have not actually changed the root user but removed the first user from the list of administers then this is relatively easy to fix.

Press CTRL+ALT+T and enter id

You should see something similar to.

~$ id
uid=1000(warren) gid=1000(warren)groups=1000(warren),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),109(lpadmin),124(sambashare)

If this shows sudo you should be an administrator. In Ubuntu prior to 12.04 the group was admin If not this is the problem.


First you need to boot to a root shell if you don't normally see grub when you boot hold SHIFT.

You should see something like this:

grub

Select recovery mode, then drop to root shell.

grub2

Finally mount the file system read write

mount -o rw,remount /

If the problem was that you were not in the sudo group it can be fixed with

usermod -aG sudo warren

replacing warren with your user name. If you are not sure what the user name should be it was the uid= field from the id command you ran earlier.

replace sudo with admin if you are using a version of Ubuntu prior to 12.04.


Another less likely possibility is that you have changed the sudoers file

If this is the problem then enter

visudo

Edit this file to look like this (12.04 default):

#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults    env_reset
Defaults    secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

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

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d
0
6

At the grub boot selection screen (if this doesn't show up hold shift at boot) select ubuntu recovery mode and press enter, then select root terminal (or something similar it may be called root shell) from the list of options. Then type mount -o rw,remount / to gain read/write access to the filesystem. Then type adduser adminusernamehere sudo to give the admin user that you changed to standard sudo (root) privileges.

-2

Go to the User Accounts.

Users
Image from Eliah Kagan's answer to How to manage users and groups?

Then, click on 'Advanced Settings'.

Advanced Settings
Image from How to create a Ubuntu 12.04 x64 LTSP server with 32bit thin clients by The Fan Club

Then, tick any boxes you want. The one you want though, is Administer the System.

Hope this helps!!

1
  • 7
    He can't do that as he can't change settings in user accounts, due to not having an administrator account on the system. Apr 8, 2013 at 18:10

Not the answer you're looking for? Browse other questions tagged .