This question already has an answer here:

Is there a way to run a Gui application (X11) in background so that if I disconnect, I can resume the running app again?

I am using SmarTTY on windows to connect to remote CentOS. When I run a Gui application (e.g. gnome-help) it starts Xming server and displays its window.

I want to keep it running even if I disconnect, crash or close ssh connection. So that I can get back to running applicaition later.

I have tried 'screen' and '&' and combination of both but neither works. I can not connect again to the GUI application when SSH connection is closed.


As answered by Anthon

  1. Install both the VNC Server and VNC Viewer on the remote system (e.g. CentOS).
  2. Start VNC Server on remote Xvnc -localhost :13
  3. Start VNC Viewer so that it displays locally via X (e.g. on your Windows)
  4. Set display export DISPLAY=:13
  5. Start a GUI application and it will be displayed in the VNC Viewer

marked as duplicate by Gilles ssh Dec 18 '14 at 12:38

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


The X application needs a screen to connect to and normally (if you connect via ssh using -X that is your local screen). What you can do instead is use Xvnc and create a virtual screen for you X application to connect to and then, after logging back in, use a vncviewer to observe what is happening on this virtual screen. This functions in a similar way as using screen or tmux for terminal sessions.

You start Xvnc via:

  Xvnc -localhost -SecurityTypes=None :13

with 13 being a unique number. You use this number to set your DISPLAY environment variable before starting the X application.

During startup Xvnc will tell you which port to use to connect (5913 in my case). If you do not specify -localhost you can connect over the network directly using a vnc viewer without first having to login using ssh (this depends on your firewall of course, and you should use password protected connections instead of -SecurityTypes=None)

On Debian based systems you can install Xvnc from the package vnc4server

  • I can only connect with SSH port (22). I am not sure how many other ports are open, because many are blocked by institute. – LifeH2O Dec 18 '14 at 11:58
  • Then just use -localhost and first ssh into the machine. xvncviewer can display via X as well ;-) – Anthon Dec 18 '14 at 12:06
  • I have installed Xvnc (TigerVNC) by following instructions from krizna.com/centos/install-vnc-on-centos-6 On my Windows client I have installed UltraVNC Viewer. Default port 5900 for VNC is probably blocked. Also it does not allow me to use port 22 to connect with remote machine with UltraVNC as remote::22 – LifeH2O Dec 18 '14 at 12:28
  • @LifeH2O as I already wrote just ssh into the machine as usual and use xvncviewer to connect to th Xvnc instance. – Anthon Dec 18 '14 at 12:29
  • From the duplicate question I found that I have to tunnel through SSH connection to connect to VNC server. There is no xvnc4viewer for CentOS. I am trying to connect CentOS from windows machine and all ports but SSH are blocked. Sorry, can not understand what you are suggesting. – LifeH2O Dec 18 '14 at 13:29

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