I'd like to change the home directory of the user that I initially setup on Windows Subsystem for Linux. I found this command

sudo usermod -d /mnt/c/Users/Alex alex

Which should allow this, however I am getting this error

usermod: user alex is currently used by process 2

Presumably because I am logged in as that user. I've tried going to root by doing sudo su - and then running the command again but I get the same issue. I tried a command I found on Google to log out the user alex from root but that also kicked me out of bash entirely.

Any thoughts?

  • Can you not logout of that account, login as another account, and then run the commands to see what result you get? Oct 11, 2016 at 20:53
  • Logging out of that account closes Linux bash and gets you back to Windows prompt. Logging back in just puts you by default in that user. And switching to root through sudo su - I still get the process error
    – Xeon06
    Oct 11, 2016 at 21:25
  • I see, I assume you cannot log into the Windows as another account while logged out of that one, and then run the bash command then from that account in bash for the other account? I've not setup bash within Windows yet so just thinking of potential simple solutions even though having to do that would be sort of inconvenient but if it's just a one-time deal then done, maybe it'd work. Quick thoughts only though. Oct 11, 2016 at 23:25
  • Unfortunately the bash environment is tied to the current user Windows, stored in %appdata%. So another user will get their own bash environment
    – Xeon06
    Oct 12, 2016 at 14:43
  • You can change the default user name by executing in Windows (not bash) lxrun /setdefaultuser myusername.
    – harrymc
    Oct 12, 2016 at 20:23

5 Answers 5


Changing the home directory with WSL is done the same way as in Linux:

  1. Enter bash
  2. Type the command sudo vim /etc/passwd
  3. Find your account's line, which might look like:
  4. Change the home directory, which above is /home/harry, to the new directory, using WSL notation (If you want to set Windows directory as home directory, you need to prepend it with /mnt/, like /mnt/c for C:/, /mnt/d for D:/, etc)
  5. Save the file and exit vim by typing :wq and press Enter
  6. Exit bash and re-launch it
  7. To test, use the commands:
    cd ~

Let me know if you need more information.

  • 1
    I don't know WSL, I'm just curious: in general is it safe to just vim /etc/passwd? In Linux we have vipw especially for the job. Oct 13, 2016 at 19:55
  • @KamilMaciorowski: I have just started with WSL, but I can say that sudo /usr/sbin/vipw does exactly the same as my point 2 above. Changing /etc/passwd is as safe as doing it on Linux. Maybe safer because destroying it does not affect Windows logon.
    – harrymc
    Oct 13, 2016 at 20:00
  • 1
    Thank you! I don't know why the only way I could find to edit this was through usermod.
    – Xeon06
    Oct 13, 2016 at 22:02
  • 4
    Be careful with this - if you move out of the main fake linux filesystem, you'll find you can't edit file permissions properly.
    – Hippyjim
    May 12, 2017 at 15:04
  • 1
    @AndrewKoster what edit to .bashrc is needed to accomplish the same goal in a safer way? Mar 22, 2023 at 15:46

As at 2021, there's a better way to log in as root and change user's home directory:

  • Press Win + R
  • Enter cmd /C wsl -u root
  • A root terminal will open and now you can use the usermod -d <path> <user> command with no problem (e.g. usermod -d /mnt/c/Users/Alex alex)

You can try running lxrun /setdefaultuser root in command prompt, then change the directory, then change the default user to Alex.


To avoid shown error ("user ... is currently used by process") : the user must not be logged in into wsl VM.

  1. into VM : edit /etc/wsl.conf to change default user from "the user to be renamed" to root
  2. exit VM
  3. terminate VM : wsl -t my_vm
  4. execute command : wsl -d my_vm -e usermod ...add_your_args_here...
  5. "rollback" of #1 (from root to "new username").

When using answer by @harrymc you need to copy .bashrc to your new homedir.

cp <old_bashrc> ~

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .