4

Many websites says I should use lxrun /setdefaultuser, but this command is deprecated:

C:\WINDOWS\system32>lxrun /setdefaultuser foo

Warning: lyrun.exe is only used to configure the legacy Windows Subsystem for Linux distribution.

How can I change the default username which is in my case root. I would like it to be the same username as I use with my Windows account.

Btw I am using mintty to run WSL:

%LOCALAPPDATA%\wsltty\bin\mintty.exe --WSL= -h err --configdir="%APPDATA%\wsltty" -~ 
  • Could be but there is no /setdefaultuser option :( – nowox Nov 9 '17 at 12:32
  • @Ramhound: Why did you post a bounty when your own answer is accepted? – harrymc Jan 22 '18 at 15:24
  • @Ramhound: I have the exact same question :) – nowox Jan 22 '18 at 15:27
  • Does the accepted answer solve your issue? – nowox Jan 22 '18 at 15:45
  • @Ramhound: What do you expect to achieve? Do you intend to never award the bounty, so nobody gets more than half the bounty and that also only if at least two voters happen to like the answer in the next 5-6 days? You know well that most voters will only look at the accepted answer and go away uninterested. – harrymc Jan 22 '18 at 16:28
7

Microsoft has documented how this is done on Fall Creators Update and later.

To see what commands are available for a particular distribution, run [distro.exe] /?.

For example, with Ubuntu installed:

C:> ubuntu.exe /?

enter image description here

Which means in order to change the default user to root in Ubuntu you would use the following command.

C:\> ubuntu config --default-user root

The documentation indicates the following:

enter image description here

Source: User Accounts and Permissions

  • I wouldn't have been able to find the documentation page if it wasn't for this answer so be sure to give it an upvote. – Ramhound Nov 9 '17 at 16:10
  • How to set default user to root in WSL also submitted a similar answer but I didn't find it until after I submitted my answer. – Ramhound Nov 9 '17 at 16:13

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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