Saturday, February 17, 2007

Graphical Login in VNC

This creates a VNC server that does not require authentication for VNC. After connecting a loginbox is displayed so multiple users can login to their desktop on this server. This procedure is heavyly based on this site: http://linuxreviews.org/howtos/xvnc/

First you need to install and configure xinetd and allow xinetd to listen to external calls: open /etc/xinetd.conf Make the line a comment by adding a # in front of it: only_from = localhost

Open /etc/X11/xdm/xdm-config find DisplayManager.requestPort :0 and comment it out by inserting a ! at the beginning of the line.

The user nobody must have a valid shell assigned when using xdm. You will only get a gray screen when connecting to xdm if nobody has the default /bin/false set.

usermod -s /bin/bash nobody

Edit kdmrc

[Xdmcp]
Enable=true
Willing=/etc/X11/xdm/Xwilling
Xaccess=/etc/X11/xdm/Xaccess
Port=177

[X-*-Core]
AllowShutdown=None
AllowRootLogin=false
Optional: Edit /etc/X11/xdm/Xaccess and uncomment the line '* #any host can get a login window by removing the single quote '.

It is better to use 192.168.0.* or 127.0.0.1 than * for security.

Cut & paste the following lines to your /etc/services:

services.txt
vnc-1024x768x16 5900/tcp

Create a file called /etc/xinetd.d/xvncserver

service vnc-1024x768x16
{
protocol = tcp
socket_type = stream
wait = no
user = nobody
server = /usr/bin/Xvnc
server_args = -inetd -query localhost -once -geometry 1024x768 -depth 16
}

Restart xinetd
/etc/init.d/xinetd restart

Start or restart the gdm/kdm/xdm service
/etc/init.d/xdm restart

You might want to enable xdm auto start, save this text as /etc/rc.d/init.d/xdm:

[XDM]
#!/bin/sh

# chkconfig: 234 60 60
# processname: /usr/X11R6/bin/xdm
# config: /etc/X11/xdm/xdm-config

# source function library
. /etc/rc.d/init.d/functions

[ -x /usr/X11R6/bin/xdm ] exit 0

prog=/usr/X11R6/bin/xdm

RETVAL=0

start () {
echo -n $"Starting $prog: "
# start daemon
daemon $prog
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/xdm
return $RETVAL
}

stop () {
echo -n $"Stopping $prog: "
killproc $prog
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/xdm
return $RETVAL
}

restart () {
stop
start
RETVAL=$?
return $RETVAL
}

case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $prog
RETVAL=$?
;;
restart)
restart
;;
condrestart)
[ -f /var/lock/subsys/xdm ] && restart :
;;
reload)
echo -n $"Reloading $prog: "
killproc $prog -HUP
RETVAL=$?
echo
;;
*)
echo $"Usage: $0 (startstoprestartcondrestartreloadstatus)"
RETVAL=1
esac

exit $RETVAL
[/XDM]

No comments: