Can't login as root anymore

15,627

Solution 1

You will need to get root privileges at boot time. Then you can revert the change you made and reset the password on the primary account.

How do I reset a lost administrative password?

Be very careful changing usernames. /etc/passwd associates each username with a user ID (number). In some places in the system the number is used, in others the name. To change a username without breaking things you therefore have to change the name everywhere it occurs. I would recommend that you not try to change your username unless you are an expert. If you are an expert then I don't have to tell you about usermod(8). ;-)

Solution 2

I'we lost my root acsess, but can login in ubuntu...

Solved with this metod:

Reboot in to recovery mode and to get Read/Write enabled done this

mount -o rw,remount /
chmod 0440 /etc/sudoers
chown root /etc/sudoers

Than added me to root user with this

sudo adduser <my username> sudo

When you replace my username with yours (without the <>)

To check username do this

ls /home

To change your password do this

passwd <your password>

When you replace my password with yours (without the <>)

When done youst typereboot and you are done...

p.s. sorry for my bad English?!

Share:
15,627

Related videos on Youtube

Dominik Berger
Author by

Dominik Berger

Updated on September 18, 2022

Comments

  • Dominik Berger
    Dominik Berger over 1 year

    I wanted to change my username, and tried out this explanation here: https://askubuntu.com/a/205470/112035.

    First, I changed the username in /etc/passwd to the new one. Then I wanted to change it at /etc/group too, but since changing it at the first file I can't login as root anymore.

    Is there a way to solve this? Thanks in advance!

    • Melon
      Melon over 11 years
      Hm, did you backup these files by any chance?
    • Arin Chakraborty
      Arin Chakraborty over 11 years
      do sudo nautilus in terminal and proceed.