I was renaming home directory user of my another Ubuntu account using terminal:

sudo usermod -d /home/<new_home_directory_name> <another_username>

By mistake, I missed -m option between <directory name> and <user_name>. Now I'm not able to login into that account.

When I login to that user using Ctrl+Alt+F1, pwd returns /. I can see 'Access-Your-Private-Data.desktop' when I do ls in <older_home_directory>.

Let me know how can I recover my account as it is the main account.

  • What output do you see for ls /home/* ? – ARG Nov 7 '18 at 14:48

Start Ubuntu as root and restore: Press the Shift key during boot to get the grub menu and select a revocery mode.


When you forgot the -m option to usermod, you didn't move the home directory at all. You already observed that the old directory is still there and visible from ls, so you can undo your previous change by calling usermod again:

sudo usermod -d /home/<old_home_directory_name> <username>

On a terminal you will have / as your home, as you pointed out. So go back there and just change your home in your passwd file...


sudo vi /etc/passwd

Find your username, the 6th field is your home directory. Set it to your home... e.g. mine is /home/number9. Save and exit that file. Login and be happy.

Note, if you don't know vi/vim, use nano or your favorite editor.

Note further, if your home is encrypted, you will need to follow these instructions. If you are moving it to a new location and not partition, just use the location, not the partition.

  • Hi, I did the same and it is working as earlier. But I want to change the name of my 'home' directory. When I try to do that, it changed the name but I'm seeing cross sign on that home directory when seen from another account. And then again I am unable to login to that account. When I logged in using Ctrl+Alt+F1, I can see "Access-Your-Private-Data.desktop" and README.txt file under that home directory. Can't I change the name of my home directory. – GeniusGo Nov 8 '18 at 6:24
  • @GeniusGo you should be able to change the name of your home directory... you would login as your user, sudo vi /etc/passwd, and change the name. Know that you must also change the name of the actual dir. e.g. if your old dir was /home/fred and you want /home/flintstone, you would change it in /etc/passwd and then cd /home ; mv fred flintstone – number9 Nov 8 '18 at 11:24
  • Then it gives me error: mv: cannot move '<old_directory_name>' to '<new_directory_name>': Device or resource busy – GeniusGo Nov 8 '18 at 17:00
  • @GeniusGo then you are probably in the directory, or something has it open. something like lsof |grep old_directory_name should give you some insight – number9 Nov 8 '18 at 18:23
  • My old home directory seems to be encrypted with ecryptfs. May be that is one reason it is not allowing me to rename the directory. – GeniusGo Nov 10 '18 at 5:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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