5

I've got X11 forwarding on so I can see program windows on my server from my desktop, I'm wondering if I disconnect from the ssh session with the x11 forwarding to my PC, will that program close on the server side upon disconnecting? If it does, is there a way to prevent that?

I have MEGASync running on my server and it needs an X server running to use it, I cannot use VNC because iptables is acting strangely, can't open the port properly. I'd like to keep megasync running on the server without having to stay connected to SSH so I can turn my PC off.

Any way to do this?

  • I would use screen but not sure how that works with -X. – Jonatan Öström Aug 26 '16 at 11:53
3

Xpra seems to be exactly what you are looking for. It's a bit like screen or tmux but for X11 applications.

See this answer on http://unix.stackexchange.com for an example.

1

There are 2 avenues I would explore. the simplest is just to keep the ssh alive by adding ServerAliveInterval 60 to your ssh client config

cat <<- EOF >> $HOME/.ssh/config

    # send packets over ssh every 60 seconds to keep ssh connection alive
    ServerAliveInterval 60
EOF

or alternatively install screen or tmux, personally I use tmux

so on the server you would need to run

sudo apt-get install tmux

then launch tmux on server

tmux -2

connect to the server with

ssh -X -C -c blowfish-cbc,arcfour [-pPORT_NUM] user@1.2.3.4

where

  • -X Enables X11 forwarding.
  • -C Requests compression of all data (including stdin, stdout, stderr, and data for forwarded X11, TCP and UNIX-domain connec‐ tions).
  • -c is the cipher type

the compression stuff is not essentially but reduces lagginess/responsiveness with the server

Then launch your program from inside the tmux session

i.e.

$ your program

if your ssh gets disconnected, the program should remain running on the server, to reconnect with the program once you get a new ssh connection going, run

tmux attach

on the server

  • -c blowfish-cbc,arcfour Don't recommend using broken ciphers! Also compression is useless these days. – Jakuje Aug 26 '16 at 15:28

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.