wsl-sudo
wsl-sudo copied to clipboard
`socket.timeout: timed out` when running under sudo or otherwise as root?
Is there any way I can use both wsl-sudo.pl
and sudo
at the same time without having to enter my linux password every time?
As I pointed out in #1, wsl-sudo works fine to edit e.g. the hosts file under WSL2, but I also need my script to have linux sudo priviledges.
If I run
wsl-sudo.py sudo ls -l
sudo asks for a password every time, presumably because wsl-sudo.py creates a new pty for each invocation.
But if I run this (where I preserve the PATH
so it can find wsl-sudo.py and misc. windows binaries):
sudo env "PATH=$PATH" wsl-sudo.py ls
I'm presented with the UAC prompt but then get this, which I'd like to avoid:
Traceback (most recent call last):
File "/home/peter/bin/local/wsl-sudo/wsl-sudo.py", line 332, in <module>
main()
File "/home/peter/bin/local/wsl-sudo/wsl-sudo.py", line 328, in main
UnprivilegedClient().main(**vars(args))
File "/home/peter/bin/local/wsl-sudo/wsl-sudo.py", line 233, in main
self.sock, acc = listen_socket.accept()
File "/usr/lib/python3.8/socket.py", line 292, in accept
fd, addr = self._accept()
socket.timeout: timed out
This occurs both if I run as above, if I run sudo -i
to get an interactive shell, or run wsl -u root
to start a brand new WSL session.