Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 http://it.megocollector.com/?p=1300 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?

Thanks!

share|improve this question

1 Answer 1

up vote 0 down vote accepted

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

VNCSERVERS="2:quanta"

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

vncserver :2
vncserver -kill :2

Edit

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

function start() {
    SESSION=$1
    ...
    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
else
    for display in ${VNCSERVERS}
    do
        start $display
    done
fi
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

 
discard

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.