0

Ok, I just installed Ubuntu 12.04 and I was an administrator, but then someone made a standard user and deleted the admin account. How do I make a new admin user without it asking me to enter a password? Or, is deleting the OS and reinstalling it the only option?

Omar
  • 1
  • How did they delete the admin account without having admin rights themselves? –  Jun 02 '16 at 22:45
  • the admin account was unlocked so they would've been able to delete it and when I came back it was locked so every time I want to unlock to make an admin it asks me for authentication password and it wont accept it unless i am an admin user – Omar Jun 02 '16 at 22:48
  • I don't follow what you mean by locked or unlocked. Each user in Ubuntu is a user, if they are in the sudo'ers file they have permission to elevated commands. Unless an admin can delete themselves using sudo, I have no idea how another user without sudo permission could delete any user. –  Jun 02 '16 at 22:52

1 Answers1

0

Nope! There is no need to reinstall Ubuntu!

Here are the steps you need to take in order to add a new admin account:

Shutdown the computer.

Hold down the shift key and you will be greeted by the "grub" menu (it looks similar to the image below). Next, select the second option on the grub menu:

enter image description here

Once you selected the second option on the grub menu, you will see another menu with several recovery options: enter image description here

Select the "root" option. then you will see a root terminal-prompt like this:

root@ubuntu:~#

You are going to have have to remount your Ubuntu partition to continue. At the prompt type:

mount -o rw,remount /

Next type (this will create the new admin account):

passwd username

Now it will prompt you to type in a new password:

Enter new UNIX password:
Retype new UNIX password:

This is how the results should look like:

passwd: password updated successfully
root@ubuntu:~#

Next, reboot the computer by typing:

shutdown -r now

Or, if you want to just change your standard account into an admin account type:

adduser username sudo

You should now see a message saying 'adding user' followed by another one saying: "done".

Reboot by typing:

shutdown -r now

I hope this fixes your problem. Good Luck!

muru
  • 197,895
  • 55
  • 485
  • 740