I run a headless VM (an old WinXP) on a Ubuntu server. I haven't used it in a while, and I just started it but it won't connect via ssh tunnel.
I start the VM on the server like this:
client $ ssh -CYL 3389:localhost:3389 dargaud@server
server $ VBoxManage startvm "OldXP" --type headless
server $ VBoxManage list runningvms
"OldXP" {ebb9b585-84b3-4057-8fc7-e3a43735abcd}
server $ VBoxManage list -l runningvms
...
VRDE: enabled (Address 0.0.0.0, Ports 3389, MultiConn: on, ReuseSingleConn: off, Authentication type: null)
Then I try to start rdp:
client $ krdc rdp://localhost:3389
The above starts an grey X11 window on the remote server, with a decoration-less firefox running in it.
client $ rdesktop localhost
The above opens a [login to xrdp] remote box asking for module, username and password.
I feel like the Windows VM is not listening on RDP anymore, but the status above seems to give the right configuration, and also:
$ sudo lsof -n | grep :3389
xrdp 2632 xrdp 6u IPv4 26202 0t0 TCP *:3389 (LISTEN)
VBoxHeadl 20918 dargaud 19u IPv6 13856839 0t0 TCP *:3389 (LISTEN)
nspr-1 20918 20920 dargaud 19u IPv6 13856839 0t0 TCP *:3389 (LISTEN)
nspr-2 20918 20921 dargaud 19u IPv6 13856839 0t0 TCP *:3389 (LISTEN)
VBoxSVCWa 20918 20923 dargaud 19u IPv6 13856839 0t0 TCP *:3389 (LISTEN)
TimerLR 20918 20925 dargaud 19u IPv6 13856839 0t0 TCP *:3389 (LISTEN)
MainHGCMt 20918 20927 dargaud 19u IPv6 13856839 0t0 TCP *:3389 (LISTEN)
VRDP-IN 20918 20928 dargaud 19u IPv6 13856839 0t0 TCP *:3389 (LISTEN)
VRDP-OUT 20918 20929 dargaud 19u IPv6 13856839 0t0 TCP *:3389 (LISTEN)
remote 20918 20930 dargaud 19u IPv6 13856839 0t0 TCP *:3389 (LISTEN)
EMT-0 20918 20931 dargaud 19u IPv6 13856839 0t0 TCP *:3389 (LISTEN)
EMT-1 20918 20932 dargaud 19u IPv6 13856839 0t0 TCP *:3389 (LISTEN)
ShClipboa 20918 20933 dargaud 19u IPv6 13856839 0t0 TCP *:3389 (LISTEN)
DragAndDr 20918 20934 dargaud 19u IPv6 13856839 0t0 TCP *:3389 (LISTEN)
GuestProp 20918 20935 dargaud 19u IPv6 13856839 0t0 TCP *:3389 (LISTEN)
GSTPROPNT 20918 20936 dargaud 19u IPv6 13856839 0t0 TCP *:3389 (LISTEN)
GuestCont 20918 20937 dargaud 19u IPv6 13856839 0t0 TCP *:3389 (LISTEN)
Timer 20918 20938 dargaud 19u IPv6 13856839 0t0 TCP *:3389 (LISTEN)
PDMNsTx 20918 20939 dargaud 19u IPv6 13856839 0t0 TCP *:3389 (LISTEN)
ShFolders 20918 20940 dargaud 19u IPv6 13856839 0t0 TCP *:3389 (LISTEN)
ATA-0 20918 20941 dargaud 19u IPv6 13856839 0t0 TCP *:3389 (LISTEN)
ATA-1 20918 20942 dargaud 19u IPv6 13856839 0t0 TCP *:3389 (LISTEN)
INTNET-RE 20918 20943 dargaud 19u IPv6 13856839 0t0 TCP *:3389 (LISTEN)
INTNET-XM 20918 20944 dargaud 19u IPv6 13856839 0t0 TCP *:3389 (LISTEN)
OhciFrame 20918 20946 dargaud 19u IPv6 13856839 0t0 TCP *:3389 (LISTEN)
ACPI\x20P 20918 20947 dargaud 19u IPv6 13856839 0t0 TCP *:3389 (LISTEN)
USBDevIo- 20918 20948 dargaud 19u IPv6 13856839 0t0 TCP *:3389 (LISTEN)
If I kill the VM, there are no more listeners on 3389, so it's not a conflict.
Stupid of me, I hadn't noticed the 1st line of lsof: an xrdp server was running on the same port.
service xrdp stop
and then a restart of the virtual machine solved it.