Linux – Windows Subsystem for Linux – sudo does not ask for password everytime

linuxSecuritysudoUbuntuwindows-subsystem-for-linux

I'm becoming increasingly concerned with the relaxed effort I'm getting from sudo. In a VM im testing WSL. The VM is just for the windows guest, so I can see what I can access with WSL, and what I can break. What concerns me is that I've noticed upon opening a shell a few times that sudo su does not ask me for my password. Here's an example of 5 concurrent shells 3 from BoUoW and 2 from cmd.

enter image description here

They are ordered in the order they were run. Notice the first two, which completely bypass the password phase. I'm root. that's it. No hacks required. No shells were open apart from these. The first two sent me directly into root. Then suddenly it starts to ask me for it again.

Some notes:

  • The number of unprotected terminals varies, sometimes I can directly access root once, sometimes 6 times before it starts asking.
  • System reboot is completely independent. Rebooting does not greet me with a guaranteed password protected root shell.
  • Once the password protection starts to kick in, I have not noticed it stop. Unless all terminals are closed. Process repeats.

Another strange case is that while the terminal gives me root access, I can type su nalaurien to get from root to nalaurien. But then it askes for a password. After it also again asks for a password to go back from nalaurien to root.

If sudo su asks for a password to get to root, I require no password to su nalaurien back. Does anyone have any insight into this one?

UPDATE:

btw fixed the issue where bash was screaming at me that it couldn't resolve my host. Stated problem still exists.

Best Answer

Might be related to sudo credential caching on by default - check and try to edit the sudoers file to change this behavior.

Related Question