Xquartz ssh -X sessions: how to detach/reattach to persistent windows

255 views Asked by At

I've installed xquartz on my OSX machine, and upon connecting to a remote server with ssh -X [email protected] I'm able to launch gui windows (let's say Rstudio for example --I see the window show up on my screen even though it's running on the remote server -neato!).

What I'd like to do is create stable, persistent sessions to disconnect/reconnect to (i.e. close and re-open the same window with my environment and variables still there, instead of closing it and opening another one).

Hence, I'm using a tmux session from the terminal so that I can detach from my ssh connection to the server and connect back later. What I'd like to do then is re-launch the gui windows that I started from that session previously. Unfortunately, I don't know how to "store" or "detach" from the GUI windows once they are created --if I close them, then the unsaved data is deleted and the session is lost.

Is there a way to launch a persistent window from within ssh -X, and then "hide" that window, and re-open it after connecting again later?

1

There are 1 answers

0
sturu On

Not sure if this will still help now but I'll put it here for posterity. For the specific RStudio case you'd be better off installing a server version of RStudio - either the paid RStudio Workbench or the free open-source version. The server versions provide the persistent sessions you're looking for, including for long-running jobs.

The open source version has a login, but all passwords are sent in unencrypted - don't expose it to the internet without other protections. In the open-source version you can only have one session per user.

Even without allowing access to the public internet you could forward port 8787 over ssh ( -L 8787:localhost:8787) & log into the remote RStudio Server instance from your local browser by visiting localhost:8787.