VNC Server Konfiguration

Um auf entfernte Systeme via VNC zugreifen zu können, sind folgende Schritte notwendig (hier: RHEL4)

Voraussetzungen

Installation von vnc-server

yum -y install vnc-server

Konfiguration

User für den Fernzugriff anlegen

useradd -m vncadmin

Kennwort festlegen

su - vncadmin
vncpasswd

Virtuellen Desktop konfigurieren /etc/sysconfig/vncservers 1)

VNCSERVERS="1:vncadmin"
VNCSERVERARGS[1]="-geometry 800x600"

xstartup für vncadmin anpassen

#!/bin/sh

# Uncomment the following two lines for normal desktop: (e.g. KDE)
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &

Startup-Skript

#!/bin/bash
#
# chkconfig: - 91 35
# description: Starts and stops vncserver. \
#              used to provide remote X administration services.

# Source function library.
. /etc/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

unset VNCSERVERARGS
VNCSERVERS=""
[ -f /etc/sysconfig/vncservers ] && . /etc/sysconfig/vncservers

prog=$"VNC server"

start() {
    echo -n $"Starting $prog: "
    ulimit -S -c 0 >/dev/null 2>&1
    RETVAL=0
    for display in ${VNCSERVERS}
    do
        echo -n "${display} "
        unset BASH_ENV ENV
        DISP="${display%%:*}"
        export USER="${display##*:}"
        export VNCUSERARGS="${VNCSERVERARGS[${DISP}]}"
        initlog $INITLOG_ARGS -c \
            "runuser ${USER} -c \"cd ~${USER} && [ -f .vnc/passwd ] && vncserver :${DISP} ${VNCUSERARGS}\""
        RETVAL=$?
        [ "$RETVAL" -ne 0 ] && break
    done
    [ "$RETVAL" -eq 0 ] && success $"vncserver startup" || \
        failure $"vncserver start"
    echo
    [ "$RETVAL" -eq 0 ] && touch /var/lock/subsys/vncserver
}

stop() {
    echo -n $"Shutting down $prog: "
    for display in ${VNCSERVERS}
    do
        echo -n "${display} "
        unset BASH_ENV ENV
        export USER="${display##*:}"
        initlog $INITLOG_ARGS -c \
            "runuser ${USER} -c \"vncserver -kill :${display%%:*}\" >/dev/null 2>&1"
    done
    RETVAL=$?
    [ "$RETVAL" -eq 0 ] && success $"vncserver shutdown" || \
        failure $"vncserver shutdown"
    echo
    [ "$RETVAL" -eq 0 ] && rm -f /var/lock/subsys/vncserver
}

# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart|reload)
        stop
        sleep 3
        start
        ;;
  condrestart)
        if [ -f /var/lock/subsys/vncserver ]; then
            stop
            sleep 3
            start
        fi
        ;;
  status)
        status Xvnc
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart|condrestart|status}"
        exit 1
esac


RedHat Infos

1) Desktop für vncadmin auf Desktop 1 (Port 5901)
 
wissen/linux/vnc_server.txt · Zuletzt geändert: 05.09.2010 20:31
 
Recent changes RSS feed Donate Valid XHTML 1.0 Valid CSS Recent cached RSS feed cacert-signed web site: inhalt.serviert.de