When I first installed and ran Windows Linux Subsystem, console askded me to enter a new user name for bash. I input User. Now when I start bash in my console my username and PC name appeared at the beginning of the prompt, like


What should I do if I want to change my username for bash console? And PC name

  • You change the PC Name in Windows, same way you have always done so, how you change the username your logged into should be simply su'ing as that user.
    – Ramhound
    Aug 5, 2016 at 7:23
  • @Ramhound Thanks. But how to change user name for bash ? If I will change user name in windows it's don't change in bash console
    – Michael
    Aug 5, 2016 at 7:25
  • If you have changed the PC Name, and your Windows username, and it isn't showing up in bash then you will have to reset the environment. I already suggest how you switch users within bash though.
    – Ramhound
    Aug 5, 2016 at 7:27
  • You can switch "hosts" by simply using ssh hostname. Look at the configuration page to determine what your current hosts are. Two should already exist, the one your currently trying to access and the one you previously created.
    – Ramhound
    Aug 5, 2016 at 7:36

3 Answers 3


According to therobyouknow's comment, LxRun.exe is deprecated now.

Please refer to Mitchell Van Manen's answer if you're using the new version of subsystem.


You should use LxRun.exe command locating in C:\WINDOWS\system32.

Here are two solutions, which are all run in cmd.exe instead of bash.

  • Use the command below to create a new user and set it as the default user:

    LxRun.exe /setdefaultuser NEW_USER
  • OR Uninstall Linux subsystem fully and reinstall it

    LxRun.exe /uninstall /full
    LxRun.exe /install

    The next time you reenter bash, it will prompt you to input username.

  • For a newer version of the subsystem (i.e. one downloaded/upgraded-to as of date of this comment), one would need use the answer provided by @Mitchell Van Manen - superuser.com/a/1280390/21353 (I found that answer to work). Otherwise you get: Warning: lxrun.exe is only used to configure the legacy Windows Subsystem for Linux distribution May 22, 2018 at 18:36
  • 1
    @therobyouknow thanks for the reminder! I've updated my answer.
    – oryxfea
    May 23, 2018 at 2:17
  • You're welcome +1 upvote on your comment oryxfea and answer and also +1 upvote on Mitchell Van Manen's answer. Thank you. May 23, 2018 at 11:59

In the new version of the subsystem, the command is (from elevated cmd.exe):

C:\> ubuntu run sudo usermod -l newUsername oldUsername

this way you will circumvent logging in with the old username first.

  • 1
    This solved it for me with the newer version of subsystem.
    – bcar
    Jan 11, 2018 at 17:06
  • 1
    C:\> ubuntu run sudo usermod -l newUsername -p /home/newUsername -m oldUsername also renames home folder
    – Pav K.
    Oct 10, 2018 at 13:04
  • 1
    @PavK. I believe there's a typo in your answer: The "-p" (which is for passwords) should be "-d" (which is for changing the home directory). At least that was what worked on my system.
    – IvyMike
    Oct 20, 2020 at 21:00
  • The comment with @IvyMike correction worked well for me. Had to remember to change the "startingDirectory" setting in the Windows Terminal settings, or equivalent, if using it to start in your home directory.
    – Toby
    Jul 30, 2021 at 10:36

Article thread.

You have to create a ssh_config and put your username into it. The location within the Windows Linux Subsystem is /mnt/%windir%/windows

Create ~/.ssh/config file and name write your username inside the file like:

user New_User_Name

You do not have to worry about permissions.

  • Thanks. When I should create ~/.ssh/config file ? Where in Windows is root Windows Linux Subsystem directory ? How can I find it ?
    – Michael
    Aug 5, 2016 at 7:41
  • it's /mnt/%windir%/windows
    – phuclv
    Aug 5, 2016 at 8:53
  • I think this is more for Git Bash not the new Windows Linux Subsystem, Apr 7, 2017 at 18:35

You must log in to answer this question.

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