I'm playing around with the bash shell for Windows 10 and I noticed that I was in the root mode (whoami returns root). I'm still fairly fresh at bash but I know enough to know that using root mode is dangerous if you don't absolutely know what you're doing (like me).

exit and Ctrl+D don't work.

Any tips to log out of sudo?

EDIT: I created a new user account with adduser and it took me out of root mode.

  • What happens with Ctrl-D and exit? Also, add the output of env, please. – muru Oct 16 '17 at 13:30
  • There was no output. The window would just close. I think what was happening was that there was no user in the system so it defaulted to the root. I added a new user and it took me out of root and into that user mode so I think I'm all good now – Hugh O'Brien Oct 16 '17 at 13:39
  • 1
    You should use "@" followed by username to reply to someone, for example @muru – pomsky Oct 16 '17 at 13:43
  • @HughO'Brien oh. The default user of WSL unless you created one is indeed root. Root on WSL != Administrator on Windows, so you can't do any real damage using it. – muru Oct 16 '17 at 13:44
  • You must change the default user for the WSL bash. In a Windows command line, LxRun.exe /setdefaultuser <new_name> – Jaime Oct 16 '17 at 15:12