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

I have inherited responsibility for a RHEL 5 development box we are using at work that has been configured using a VNC server to allow multiple users to work on the machine at once.

The VNC service seems to have been configured along the lines of this post so that it runs at boot and creates a set of predifened user desktops specified in /etc/sysconfig, great! However, occasionally it is necessary to add a new user, or start/stop/restart the service for an existing user. At the moment the only way we can do this is to start/stop/restart the VNCservice for all users, how can I do this for just the user in question?


share|improve this question
up vote 0 down vote accepted

There is a session number for each user which is config in /etc/sysconfig/vncserver, for example:


You can use this number to start, stop a separate vnc session, something like this:

vncserver :2
vncserver -kill :2


You can custom the init script to make it can start a separate session, something as belows:

function start() {
    vncserver :${SESSION} ${VNCSERVERARGS[${SESSION}]}

And in the start) of case statement, you can check the number of parameters to decide whether starting all or individual session:

if [ -n "$2" ]; then
    start $2
    for display in ${VNCSERVERS}
        start $display
share|improve this answer
True, this does work however it simply starts a vanilla vnc session on the numbered port as the user executing the command, it doesn't load the additional configuration (eg custom resolutions/users) that we have specified in /etc/sysconfig. We can start the server as a particular user using su to first change to that user in terminal, however none of the other options configured are used. Is there a way to start the numbered server using the configuration in /etc/sysconfig as well? Thanks! – Earl Sven Aug 8 '11 at 9:53
You can append it to the end of command: vncserver :2 -geometry 800x600 -nolisten tcp -nohttpd -localhost. – quanta Aug 8 '11 at 10:26
Yes but surely this defeats the point of defining the options in the configuration file? – Earl Sven Aug 8 '11 at 10:44
I've edited my above post to answer your question. – quanta Aug 8 '11 at 11:17
Thanks, that looks more or less exactly what I need! – Earl Sven Aug 8 '11 at 11:58

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.