C:Users用户名AppDataLocalMicrosoftWindowsAppsubuntu版本.exe config --default-user root
- 文件地址还有可能在这:
C:Program FilesWindowsAppsXXX.UbuntuXXXubuntu版本.exe
- 文件地址还有可能在这:
- 在管理员cmd中运行
net stop lxssmanager
- 再次打开wsl, 即可看到默认登录用户为root
- 因为修改了默认用户, 默认进入的目录也变了, 可以通过在Linux中运行此命令修改默认进入的目录
echo "cd ~用户名" >> ~/.bashrc