changed home directory and can't login now

Asked by Nicolas

Hi all,

Needless to say, I am a complete newbie.

I have a dual boot pc with Kubuntu and Win7. Exploring KDE I went to the User Management and changed the home directory of my user to the folder of my win7 user.

The problem now is that I can't login into KDE. It goes to the login screen, I enter password and after a few blinks it goes back to the same screen. I can access as a guest but under User MAnagement I don't see my user account.

Is there a way to restore my home directory? How can I do it?

I really appreciate your help.



Question information

English Edit question
Ubuntu util-linux Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:

This question was reopened

Revision history for this message
Nicolas (nicoenz) said :

Running Kubuntu 13.04

Revision history for this message
N1ck 7h0m4d4k15 (nicktux) said :

And why on earth you changed your home directory to point to the Windows home directory ? :P

The simplest solution here is to create a new user and give to the new user admin privileges. Then just delete the old (screwed user) and all of the files.

If you want to save some files from old user account, you can just copy-paste to the new user's account. (admin).

Now lets create a new user.

1) Boot into recovery mode. From Grub menu choose "advanced options for Ubuntu" and select the entry with the (recovery mode) words.

2) From the window options select the "root"

Now pay attention to commands , write them down some where and DO NOT MAKE A MISTAKE ! Everything matters. Spaces, dashes, forward slashes.. caps or small letters.. Everything.

    mount -o rw,remount /
    adduser <username>

Where <username> replace it with the name of the user you want to create. (eg: adduser nikth)

answer to the questions and be careful with the password because nothing will appear when you write it.

After that, give this command

    usermod -aG <username> sudo

again , replace the <username> with the name of the user you just created. Above command will make the user admin.

After that, you can reboot the system with this command


and then you can login with the new admin user and delete the old corrupted user. Also before you delete the old user, be sure that you will copy any important files you want to keep.


Revision history for this message
Nicolas (nicoenz) said :

Dear NikTH,

thank you very much for your answer!! You are my sensei.

fortunately I didn't have too many documents in the home directory since I had re-installed Kubuntu a few weeks earlier and was playing around with the customization when I screwed up. And it's only a matter of re-customizing the interface.

cheers and thanks again


Revision history for this message
Nicolas (nicoenz) said :

Thanks NikTh, that solved my question.

Revision history for this message
Nicolas (nicoenz) said :

Hi NikTh,

the command:

usermod -aG <username> sudo reports the following:

user 'sudo' does not exist

any ideas what can this be?

Revision history for this message
Nicolas (nicoenz) said :


With the root user I could restore the home directory of my initial user and now it works flawlessly!!!