Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use this command to change my home directory:

sudo usermod -d new-path -m myname

But I got this error:

usermod: user myname is currently logged in

How could I change my own home directory and move all files into new-path? This server is a remote virtual machine, and connected with putty (Ubuntu 12.04).

share|improve this question
You may able to do it as root from a TTY - see this question – Wilf Aug 16 '14 at 11:07
log out. do control-alt-f1. log in. change it. type "exit". control-alt-f7. log in again. – Rinzwind Aug 16 '14 at 11:10
Thanks for your suggestion. Sorry I forgot to mention this server is a remote VM and I connect with putty. – Bangyou Aug 16 '14 at 11:12
@Wilf Thanks. Add a temporary user could be the best way to solve my problem. – Bangyou Aug 16 '14 at 11:14
I've never tried anything like this, but I would suspect you could boot from a live CD, move any directories/files, change the entry in /etc/passwd for the new home directory for your user and be good to go. Make backups of everything you intend to modify so you can put things back if it doesn't work as desired. – Joe Aug 24 '14 at 16:53

Your Answer


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

Browse other questions tagged or ask your own question.