Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I wanted to change my username, and tried out this explanation here: http://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!

share|improve this question
    
Hm, did you backup these files by any chance? –  Melon Dec 13 '12 at 10:22
    
do sudo nautilus in terminal and proceed. –  Arin Chakraborty Dec 13 '12 at 10:23

4 Answers 4

up vote 3 down vote accepted

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). ;-)

share|improve this answer

Reboot the computer into recovery mode (esc to grub and enter root prompt) and do

chmod 0440 /etc/sudoers
chown root /etc/sudoers

Reboot back to desktop and run in terminal:

sudo dpkg-reconfigure -a

This will bring you through a series of menus to allow you to reconfigure all your packages and should fix any permissions issues.

share|improve this answer

Could someone verify this?

In UNIX systems you also have an important file called /etc/shadow. Inside that file, you have encrypted password for each user. I think that you changed the files /etc/group and /etc/passwd but forgot to change the /etc/shadow. So now, you have changed a username, but you don't have actually a password for it. I am just theorizing here.

For example I created a dummy account, with dummy password. My contents of files are:

/etc/shadow
dummy:$6$ddvrCSTQ$4cAt8U.3sd6TQZ8Xi4VzOQv/GR7LA/bi72di9RE5v77y2U7os60DKbb0VLS.JPslf3g9GBBBzbNqW0y5ynkc11:15687:0:99999:7:::

/etc/group
dummy:x:1001:

/etc/passwd
dummy:x:1001:1001::/home/dummy:/bin/sh

Now I will remove the entry from /etc/shadow file. This is what I get:

su dummy
Password: <I type dummy here>
su: Authentication failure

So there you have it. You should generate a proper hash for your new user and it to /etc/shadow. Hope that helps.

share|improve this answer

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|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.