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

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Which software should I use, if I want to set up a linux VNC terminal server that works in this way:

The VNC server should be able to accept up to X simultanous connections on the same port 5900. The VNC server should use 640x480 on 8 or 16bit color.

When the VNC server receives the connection, it should start a new "session" for a user, and auto-launch a specific linux application for that user. If the application is killed, crashes, or is exited in any way, user should be disconnected (kicked) from server. If the user disconnect, the application should be killed in a "graceful way", that allows the application to cleanup.

(There should be no way to "pick up" a old session)

Any ideas?

share|improve this question
"X simultanous connections on the same port 5900" Yeah, no. – Ignacio Vazquez-Abrams Oct 27 '10 at 7:19
What do you mean? think of a web server accepting multiple simultanous connections on port 80. In the same way, I would want to do with VNC, where each client has its "own" desktop. – sebastian nielsen Oct 27 '10 at 8:00
A web server does not map ports to display numbers. – Ignacio Vazquez-Abrams Oct 27 '10 at 8:04
You know RDP, I want that functionalty, but on my linux-server. – sebastian nielsen Oct 27 '10 at 8:36

You'd better go with NX. It's just like vnc but optimized, so it's much faster and more fluent on your screen. It's also easier to prepare profiles for your users.

you can set NX so he doesn't allow users to reconnect to an already opened sessions with:


in the /etc/nxserver/node.conf file.

You can also set the command you want to be started at login in the NX client configuration. You can probably do it in the server configuration but I've never digged that far. Anyway I strongly suggest that you have a look at NX. It's available in centos extra repository and in other major linux distributions. It's based on the work of a commercial product which is partially open sourced.

share|improve this answer
NX only allows 2 concurrent connections. I want up to 10 concurrent connections. – sebastian nielsen Oct 27 '10 at 9:20
use the open source server version (freenx). It allows unlimited connections. – Rosco Oct 27 '10 at 14:46
OK, how I do to make FreeNX launch a application in a new session when a user connects? It should be "kiosk-like", so if the application crashes or exits, client should be disconnected. I just want to share a single application to the public. – sebastian nielsen Oct 27 '10 at 17:14
Use NODE_AUTOSTART. From the conf file: "This can be set to any executable, which is started after session startup". You can also find plenty of kiosk config in google "nx kiosk". There is also a "nx builder" app which is available for download but I guess it's for the commercial version only, but I'm not sure about this. – Rosco Oct 28 '10 at 9:23
Nope, FreeNX is not a solution. Too much settings on client side which gives too much work to lock down on server side. – sebastian nielsen Nov 1 '10 at 16:22

Short answer is that you cannot do this with VNC. Each TCP port will be bound to a unique session. As far as I am aware you will have the same conundrum with Xpra, VNC, NX, etc. (going via a server, like freenx, and connecting via ssh is a workaround but not an ideal one!) You may be able to workaround this by writing a simple load-balancer type of application, but this will still require one port per client.

As for the rest of your question: the dimensions are specified with -screen. For just starting Xvnc with these options, something like this should work:

Xvnc -screen 640x480x8 :100

The Xvnc session and application startup: I would place all this in a script and start it from xinet.d

The tricky part is to prevent users from re-connecting to an existing session. This is a unusual requirement since that is one fundamental feature of VNC. You may be able to get away with parsing the output of the Xvnc process and killing it (with the app) when you see a disconnection event. For killing the Xvnc when the app terminates, just wait for the appication to terminate in your script and kill Xvnc if it is still running at that point.

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.