2

Through some way I have completely erased all accounts from my laptop. When I try to add a new admin account it asks for the root password. I've tried my password from my previous account and it didn’t work. What do I do to get an admin account back?

Edit: I'm logged in through a guest account right now.

Edit: I have access to recovery mode but I'm not Sure how to get into the root account. Hasiya Rulzz, I tried this but I don't have any accounts to change the password on and it didn't work with the root account.

Edit: I am not able to download the rescue cd

Agameg
  • 25
  • 1
  • 1
  • 3
Agameg
  • 21
  • 2

2 Answers2

1

Unless you specifically set one, your root account probably does not have a password - the assumption being that you would log in as someone else and use sudo.

The guest account probably cannot use sudo, as that would be all sorts of badness.

Can you download and boot from the System Rescue CD (http://www.sysresccd.org/)?

Before you boot, do df / to work out which partition your root file system is on. e.g.

$ df /
Filesystem     1K-blocks      Used Available Use% Mounted on
/dev/sda1     192114204 101260032  81088596  56% /

tells me I need to remember /dev/sda1. I am assuming for the moment you are not using logical volumes as that adds a few steps in the next bit.

Now boot from the system rescue CD - this will (eventually) take you to a root prompt.

Now mount the root file system:

# mount /dev/sda1 /mnt

There are two ways to go here...

Simple - edit /mnt/etc/shadow, and remove root's password, change:

root:!:15842:0:99999:7:::

to

root::15842:0:99999:7:::

(note the missing !)

After this you should be able to reboot to Ubuntu and log in as root without a password (remember to set a root password after you log in!).

Complicated - If that does not work - then go back to system rescue and remount your root partition. Then try these commands:

# chroot /mnt
# passwd root

That should change the root password. Reboot, and log in as root.

David Purdue
  • 2,477
  • 13
  • 16
1

When you first turn your computer on, and your BIOS finishes posting, hold down the SHIFT key. That should bring-up your GRUB menu. From that menu, select your most-recent kernel update that finishes with the text "(recovery mode)." That should bring-up the recovery menu, where you can select the option to "Drop to root shell prompt."

Once there, you may have a read-only filesystem. If you do, you'll need to mount it:

mount -o remount,rw /

Next, create your new admin user and give it a password.

useradd newAdmin
passwd newAdmin

Then, add your new admin user to the sudo group.

adduser newAdmin sudo

Change your directory to "home" and make sure your new user has a home directory:

cd /home
ls -al

If one doesn't exist for the new admin user, add it and give the new admin user ownership of it:

mkdir newAdmin
chown newAdmin newAdmin
chgrp newAdmin newAdmin

Reboot, login as your new user, and you should be "good."

Aaron
  • 6,714