Installatie en gebruik van vnc4server voor remote beheer van een linux machine. (Desktop)

Afbeeldingsresultaat voor vnc

Installatie

apt-get install ubuntu-desktop vnc4server
maak bestand vnc4server in /etc/init.d aan
Per user vnc4server uitvoeren. Of vncpasswd
In de .vnc directory van elke user de xstartup file aanpassen
chmod 755 /etc/X11/xinit/xinitrc

Script laten runnen bij opstarten
update-rc.d vnc4server defaults
Script verwijderen
update-rc.d -f vnc4server remove

Configuratie

#!/bin/sh

# Uncomment the following two lines for normal desktop:
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 &
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
x-window-manager &

Automatische startup

/etc/init.d/vnc4server
# /etc/init.d/vnc4server
#

# Some things that run always
touch /var/lock/vnc4server

# Carry out specific functions when asked to by the system
case "$1" in
start)
echo "Starting script vnc4server "
su root -c 'vnc4server -geometry 1024x668 -depth 16 -localhost'
su sander -c 'vnc4server -geometry 1024x668 -depth 16 -localhost'
#su sander -c 'vnc4server -geometry 1600x900 -depth 16 -localhost'
;;
stop)
echo "Stopping script vnc4server"
su root -c 'vnc4server -kill :1'
su sander -c 'vnc4server -kill :2'
#su sander -c 'vnc4server -kill :3'
;;
restart)
echo "Stopping script vnc4server"
su root -c 'vnc4server -kill :1'
su sander -c 'vnc4server -kill :2'
#su sander -c 'vnc4server -kill :3'
echo "Starting script vnc4server "
su root -c 'vnc4server -geometry 1024x668 -depth 16 -localhost'
su sander -c 'vnc4server -geometry 1024x668 -depth 16 -localhost'
#su sander -c 'vnc4server -geometry 1600x900 -depth 16 -localhost'
;;
*)
echo "Usage: /etc/init.d/vnc4server {start|stop|restart}"
exit 1
;;
esac

exit 0