Setting multiple $DISPLAY variables for different login sessions

I may not have worded the subject as cleanly as I'd like, but since it's gotten quiet here, I thought I'd toss this out to the collective wisdom.

Background: I run a server (Ubuntu MATE 22.04.5 LTS). I rarely sit at the console, but I have one. Instead, I connect from one or more Mac laptops scattered about. I used either the Parallels Client or the Microsoft Remote Desktop application to connect via xrdp running on the server. Everything runs fine, and I can simultaneously connect on the console and on a laptop in separate sessions. The console, by default, is given the $DISPLAY value of :0:0. When I connect via a laptop, the $DISPLAY variable is assigned :10:0.

My frustration arises when I try to connect a third time. The new session is assigned the same $DISPLAY value of :10.0. This effectively closes my RDP session on the first laptop and "resumes" it on the new connection. This would be okay sometimes, but there are also times when I'd like to just have a third, unique session going.

One workaround I've used is to create a new user, connect via RDP and then su --login <myAccount>, but that always seems a little kludgy and I'm not always sure I get my aliases and environment variables I've built into my account.

I cannot find a way in either client program to set the $DISPLAY variable. Is there a hack I can built on the server that will detect a new connection and send a $DISPLAY value to it?

I think the issue is with xrdp, it allows only one connection per user.

Take a look at these scripts which allow multiple connections.

HTH

4 Likes

Very cool! Thank you, Pavlos.

1 Like