For most Linux Flavors VNC will not start different sessions for different users by default. The only case I have seen this work correctly has been SuSe which allows the VNC client to login after connecting (instead of the default password before connection).
Starting Multiple User VNC Sessions on Boot in Linux
This guide was developed in Linux Redhat ES 4
Step 1
- Create a new file in /etc/init.d/ named vncscript and copy the below code into it:
#--------------------------------------------------------------------------------
#!/bin/sh
#
# vncserver This shell script is an attempt at starting
# several copies of vnc as each of the required
# users on the system using the proper
# display numbers.
#
# Source function library.
. /etc/rc.d/init.d/functions
# See how we were called.
case "$1" in
start)
# Clean up any crud
# This gets rid of old lock files hanging round
rm -f -r /tmp/.X*
# Start vncserver
echo -n "Starting vnc: "
su - username1 -c "vncserver :1"
echo
sleep 5
su - username2 -c "vncserver :2"
echo
sleep 5
# su - username3 -c "vncserver :3"
# echo
# sleep 5
# su - username4 -c "vncserver :4"
# echo
# sleep 5
touch /var/lock/subsys/vncserver
;;
stop)
# Stop vncserver
echo -n "Shutting down vnc: "
su - username1 -c "vncserver -kill :1"
su - username2 -c "vncserver -kill :2"
su - username3 -c "vncserver -kill :3"
su - username3 -c "vncserver -kill :4"
echo "done"
rm -f /var/lock/subsys/vncserver
;;
*)
echo "Usage: named {start|stop}"
exit 1
esac
exit 0
#--------------------------------------------------------------------------------
- Replace "username1", "username2", etc. the users that you wish to startup VNC for (such as root).
- Note: This script was not written by me. I have no idea who wrote it but if you happen by this script and it is yours please let me know so that I can give proper credit.
Step 2
- Edit /etc/rc.d/rc.local and add this line at the bottom:
/etc/init.d/vncscript start
Step 3
- Save and exit the file. Reboot your system.
If all goes well your VNC sessions should start correctly. Try connecting to :1 from another computer to test whether this worked or not.
discuss this topic to forum
