I have installed xrdp on a Ubuntu mate 16.04 PC and set up xrdp on it. I would like to set a static port so that same session is always opened. But for some reason when I set a static port remote desktop fails to login.

In /etc/xrdp/xrdp.ini I set port to port=-1 for a random port and I see that port 3350 is used. Remote login works with port=-1 but when I set port to port=ask3350 or port=3350 remote login does not work any more. I have also tried other ports such as 5911, 5910 etc and none work.

With static port I get following message with remote desktop application in windows 7

started connecting
connecting to 3350
tcp connected

It seems to get stuck after tcp connected.

I used following steps to setup xrdp

Installed xrpd

Modified /etc/xrdp/startwm.sh to:


if [ -r /etc/default/locale ]; then
  . /etc/default/locale

. /etc/X11/Xsession


Modified [xrdp1] in /etc/xrdp/xrdp.ini to


When I run netstat I can see that port 3350 is active

netstat -an | grep "LISTEN" | grep ":3350"
tcp        0      0*               LISTEN 

ps axf | grep xrdp
 1058 ?        Sl    69:09 /usr/sbin/xrdp
 1096 ?        S      0:00 /usr/sbin/xrdp-sesman
 1946 ?        S      0:00  \_ /usr/sbin/xrdp-sessvc 1949 1948    
 1953 ?        Sl     0:00      \_ xrdp-chansrv
14406 pts/8    S+     0:00      \_ grep --color=auto xrdp

Any tips on how to fix this?


Well it seems that I have found a solution.

I ran this command to see available tcp ports on PC

netstat -an | grep tcp

I could see that port 5910 was available and I set port to port=ask5910 within [xrdp1] in /etc/xrdp/xrdp.ini.

ex below,


After I did this then remote desktop with static port 5910 worked. Not sure why it worked now because I have tried this port before and it did not work then. I did not do any changes since but for some reason it works now.

  • It seems that a remote desktop connection must first be opened via random port (port=-1) and then a ESTABLISHED port can be found via netstat and then set as static port. Not sure if this is 100% correct but it worked for me. After changing port to static I opened a new connection with it and then closed the connection with the random port. This connection will be valid until PC restarts at least in my case.
    – S4M11R
    Jul 22 '16 at 7:39

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.