WSL2 run xrdp service from Windows

I am trying to start xrdp from Windows with the method described here, but when I run the command wsl sudo service xrdp start, xrdp doesn't start up properly. Running service xrdp statusas my linux user returns

 * could not access PID file for xrdp-sesman * xrdp is not running

and I can't connect via RDP. Running wsl -u USER sudo service xrdp start gives me the same result. How can I fix this and run the service properly?

5

1 Answer

The problem is xrdp service init script does not detach stdout before returning and once wsl.exe exits, it closes all pipes which terminates the script.

Straightforward *nix tool for this problem is nohup, but it redirects output to file.

>wsl nohup sudo service xrdp start
nohup: ignoring input and appending output to 'nohup.out'

Somewhat weird workaround I've found is passing command output to cat which prevents premature termination of script and passes output.

wsl bash -c "sudo service xrdp start |cat"

In the end I resorted to a script in the external file. However, it can be written in one line. Fortunately, cmd passes everything to bash in this line.

wsl sudo service xrdp start; until service xrdp status; do sleep 1; done
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like