I have Ubuntu 18.04 and Xrdp 0.9.5. I can login directly to local desktop after boot. If I logout, I still can login via Xrdp.

Otherwise, if Xrdp session has opened, even if I closed it, I cannot login to desktop locally, I think Xrdp session is blocking it. I need to restart the machine so I can login locally.

How do I close the Xrdp session?

When I tried to login locally, the log says :

Jul 10 09:34:55 gdm-password]: pam_unix(gdm-password:session): session opened for user superadmin by (uid=0)
Jul 10 09:34:55 systemd-logind[879]: New session 3 of user superadmin.
Jul 10 09:34:57 gdm-password]: pam_unix(gdm-password:session): session closed for user superadmin
Jul 10 09:34:57 systemd-logind[879]: Removed session 3.
Jul 10 09:35:01 CRON[2485]: pam_unix(cron:session): session opened for user root by (uid=0)
Jul 10 09:35:01 CRON[2485]: pam_unix(cron:session): session closed for user root

Restarting the machine is the only way to fix this right now.


After some trial and error, and referenced to @Sylla suggestion, I found that not only Xrdp process to kill, but also XOrg

7313 ?        00:00:02 Xorg
7325 ?        00:00:00 xrdp-chansrv

After that, I can now login locally.

Now the next question is: Is there any chance I could make it automatically kill the processes after I close remote desktop?


I did not know that Xrdp has two config file (xrdp.ini & sesman.ini).

So, I created an issue in Xrdp repository here . The developer told me that the configuration is in sesman.ini. The variable named KillDisconnected will do the job. but as I read it, it cannot have less than a value of 60s.


1) First solution:

ps -u your_username | grep xrdp

will give you the process id.

You can then

kill -9 pid_number

pid refers to your xrdp process ID.

2) Second solution

If you want to close xrdp session, you can use this command

/etc/init.d/xrdp stop

And if you decide to use your xrdp:

/etc/init.d/xrdp start

To check which status you have:

/etc/init.d/xrdp status

  • i tried your suggestion: but $ sudo xrdp status Unknown Parameter xrdp -h for help not recognizing status parameter $ ps -u superadmin | grep xrdp 1818 ? 00:00:00 xrdp-chansrv $ kill -9 1818 $ ps -u superadmin | grep xrdp 1818 ? 00:00:00 xrdp-chansrv <defunct> i'm still logged in xrdp, even can reconnect xrdp normally. any suggestion?
    – Asule
    Jul 11 '18 at 9:51
  • Not 'sudo xrdp status' but "/etc/init.d/xrdp" status If the status is "active" (running), you have to run this command as root: "/etc/init.d/xrdp stop" without quotes!
    – Sylla
    Jul 11 '18 at 9:56
  • ok, actually i've tried service xrdp restart yesterday, and made me kicked out of xrdp , but still cannot login locally to desktop. just now i tried your suggestion to stop the service, now i cannot login both locally or xrdp. :(
    – Asule
    Jul 11 '18 at 10:16
  • Restart your computer and do ctrl+Alt+F1 for terminal command. And type this command: "/etc/init.d/xrdp start
    – Sylla
    Jul 11 '18 at 12:01
  • well, that is true i should restart the machine, the only one way i could login back locally, no need to start xrdp manually. But here i am looking for the better way. btw thanks for your responses.
    – Asule
    Jul 12 '18 at 1:16

I'm a bit late to the party on this one, but was experiencing the very same problem you were with almost the identical setup. I tried just about everything, including different desktops uninstalling and reinstalling gnome desktop, but nothing really worked. The only truly reliable way to login locally was to reboot the computer which wasn't the solution I was after. Quite by accident while using the remote xrdp client, rather than just closing the application from the toolbar as I usually do, I tried logging out of the remote session. Low and behold that did the trick!! I was able to reliably log in locally. So to summarize, logout out of the xrdp session rather than simply closing it. Hope this solution works for you as well.

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.