Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have an ubuntu 13.04 instance in the Amazon EC2 Cloud. I am trying to run some java programs on the server that require a GUI desktop environment. I need just 1 desktop instance to connect to via remote desktop. I would like just to be able to re-connect every time, and when I disconnect I would like the instance to keep running while I am not connected, just as if I walked away from a desktop computer. Of course it should be possible to formally "log off" of the instance, and that would end my desktop session, but many times I need the programs to continue to run while I am not physically connected.

I am wondering if any of you has had any experience with this, if so, what should I try?

Right now I have the LXDE desktop running, and I can connect via xrdp. The problems I am getting, the BIG problem, is that the desktop environment is very unstable. Many times I disconnect without notice and cannot reconnect. Also I notice that the server sometimes just shuts down my java program automatically (I am still trying to figure out the exact cause). For example just now I logged on to the LXDE and fired up my java program. minutes later the RDP disconnected and now I am unable to re-connect. I will prob have to reboot the instance.

Another problem, but not nearly as serious as the first, is that every time I re-connect via XRDP (assuming it hasn't crashed) it automatically starts a new desktop session instead of re-connecting to the old one. It isn't a big deal, I can always find the ID of the previous session and edit the config file via ssh to force a connection to that ID, but it is a pain and should be automatic.


share|improve this question

2 Answers 2

I've been running a VNC server on quite a few servers which have GUIs running inside of them for the last five years. It's not ideal, the setup is a bit clunky and security wise it's not great (passwords are concatenated at 8 chars for instance) but if you don't require high security it might be a solution for you.

share|improve this answer
sounds kinda like what I have running now. Also security is a problem on my system, i guess an open RDP connection exposed to the web isn't the best idea. –  jeffery_the_wind May 24 '14 at 11:15
I ended up trying a VNC server, which I connect to via SSH tunnel. I figured this was better security wise than a direct connection. –  jeffery_the_wind May 25 '14 at 8:17

I did some picking and ended up coming up with something that is better than what I had. I set up the tightvncserver on the EC2 cloud server using the instructions from this tutorial.

Then I was about to just connect to the tightvncserver throught an SSH tunnel, using the normal key-based connection. In order to do this, after following the above tutorial, you can connect to the server via SSH, at the same time establishing the tunnel.

ssh -i KeyPair.pem user@<ec2-server-ip> -L 9000:localhost:5901

Then you need to start the desktop session, but typing the following in your SSH command-line connection:

tightvncserver :1

Then you just need to use any old VNC client to connect to port 9000 of localhost. Remember the password is the VNC password, not the linux system password:

enter image description here

I like this much better then what I had because 1) there is only 1 desktop session that the VNC naturally re-connects to each time. 2) I don't need to open any ports besides the port for SSH. Before I had opened a port for the RDP connection. I closed that, and now just have the 1 port listening for SSH connections.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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