1. Home
  2. Windows

How To Add & Switch Users In Windows Subsystem For Linux

Windows 10 is very serious about bringing Linux to its user base. Come September and Windows 10 will add support for various Linux distros. The existing Windows Subsystem for Linux got an update with the Creators Update. If you’ve already upgraded to the Creators Update, you should update the Windows Subsystem For Linux version. When you first enable WSL on Windows 10, you create a user account. This sole account is the default account. Whenever you open WSL, it opens in this account. You can add more accounts to WSL and change the default account. Obviously there’s no GUI to add & switch users in Windows Subsystem for Linux. You need to use a command in the bash shell to add & switch users in Windows Subsystem for Linux, and change the default user.

Add New User

To add a new user, open Ubuntu on Windows 10. Enter the following command;

sudo adduser mynewuser

You will need to enter the password for the current Linux user to create a new user. When the new user has been created, you can enter a name, and a password for the user.

Switch User

To switch users, enter the following command;

su username

Replace ‘username’ with the username for the user you want to switch to.

Change Default User

You need do this via the Command Prompt. There are two scenarios when it comes to changing the default user. You have an existing user that you want to set as the new default user or you want to create a new user and set it as the default user.

To set an existing user as the default user, enter the following command;

LxRun.exe /setdefaultuser username

Replace ‘username’ with the user you want to set as the default. If the user doesn’t exist, this command will create a new user and set it as the default user.

Change Password For A User

You can change the password for a user too if you want. The command is pretty simple. Open Bash in Windows 10. Switch to the user you want to change the password for (see above). Enter the following command to change the password;

passwd

You will be prompted to enter the current password before you can change it. If you’ve forgotten your current password, you won’t be able to set a new password. There’s not much recourse for you in this matter so be careful what passwords you set. Don’t make them too easy but make them something you can remember.

Leave a comment