NB : Il faut être root pour pouvoir effectuer les opérations suivantes.
# emerge tightvnc
# emerge xinetd # rc-update add xinetd default
Pour permettre à xinetd d'accepter les accès extérieurs, éditez le fichier /etc/xinetd.conf
et commentez la ligne suivante (en plaçant un # au début) :
# only_from = localhost
Changez la configuration de XDM pour qu'il réponde aux requêtes XDCMP en éditant /etc/X11/xdm/xdm-config
. Commentez (en plaçant un ! au début) la dernière ligne
! "DisplayManager.requestPort :0"
Si vous utilisez KDM, éditez /etc/kde/kdm/kdmrc
et activez XDMCP sur le port 177.
Si vous utilisez GDM, démarrez gdmconfig
et allez sur l'onglet “XDCMP”
Vérifiez que Enable XDMCP
est coché.
Spécifiez qui a accès à distance en éditant /etc/X11/xdm/Xaccess
et décommentez la ligne
" '* #any host can get a login window"
en enlevant l'apostrophe. Vous pouvez aussi mettre 192.168.0.* pour des raisons de sécurité évidentes.
Copiez les lignes suivantes dans /etc/services
:
# # VNC Servers # vnc-640x480x8 5950/tcp vnc-800x600x8 5951/tcp vnc-1024x768x8 5952/tcp vnc-1280x1024x8 5953/tcp vnc-1600x1200x8 5954/tcp vnc-640x480x16 5960/tcp vnc-800x600x16 5961/tcp vnc-1024x768x16 5962/tcp vnc-1280x1024x16 5963/tcp vnc-1600x1200x16 5964/tcp vnc-640x480x24 5970/tcp vnc-800x600x24 5971/tcp vnc-1024x768x24 5972/tcp vnc-1280x1024x24 5973/tcp vnc-1600x1200x24 5974/tcp vnc-640x480x32 5980/tcp vnc-800x600x32 5981/tcp vnc-1024x768x32 5982/tcp vnc-1280x1024x32 5983/tcp vnc-1600x1200x32 5984/tcp
Créez un fichier /etc/xinetd.d/xvncserver
contenant
service vnc-640x480x8 protocol = tcp socket_type = stream wait = no user = nobody server = /usr/bin/Xvnc server_args = -inetd -query localhost -once -geometry 640x480 -depth 8 service vnc-800x600x8 protocol = tcp socket_type = stream wait = no user = nobody server = /usr/bin/Xvnc server_args = -inetd -query localhost -once -geometry 800x600 -depth 8 service vnc-1024x768x8 protocol = tcp socket_type = stream wait = no user = nobody server = /usr/bin/Xvnc server_args = -inetd -query localhost -once -geometry 1024x768 -depth 8 service vnc-1280x1024x8 protocol = tcp socket_type = stream wait = no user = nobody server = /usr/bin/Xvnc server_args = -inetd -query localhost -once -geometry 1280x1024 -depth 8 service vnc-1600x1200x8 protocol = tcp socket_type = stream wait = no user = nobody server = /usr/bin/Xvnc server_args = -inetd -query localhost -once -geometry 1600x1200 -depth 8 service vnc-640x480x16 protocol = tcp socket_type = stream wait = no user = nobody server = /usr/bin/Xvnc server_args = -inetd -query localhost -once -geometry 640x480 -depth 16 service vnc-800x600x16 protocol = tcp socket_type = stream wait = no user = nobody server = /usr/bin/Xvnc server_args = -inetd -query localhost -once -geometry 800x600 -depth 16 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 service vnc-1280x1024x16 protocol = tcp socket_type = stream wait = no user = nobody server = /usr/bin/Xvnc server_args = -inetd -query localhost -once -geometry 1280x1024 -depth 16 service vnc-1600x1200x16 protocol = tcp socket_type = stream wait = no user = nobody server = /usr/bin/Xvnc server_args = -inetd -query localhost -once -geometry 1600x1200 -depth 16 service vnc-640x480x24 protocol = tcp socket_type = stream wait = no user = nobody server = /usr/bin/Xvnc server_args = -inetd -query localhost -once -geometry 640x480 -depth 24 service vnc-800x600x24 protocol = tcp socket_type = stream wait = no user = nobody server = /usr/bin/Xvnc server_args = -inetd -query localhost -once -geometry 800x600 -depth 24 service vnc-1024x768x24 protocol = tcp socket_type = stream wait = no user = nobody server = /usr/bin/Xvnc server_args = -inetd -query localhost -once -geometry 1024x768 -depth 24 service vnc-1280x1024x24 protocol = tcp socket_type = stream wait = no user = nobody server = /usr/bin/Xvnc server_args = -inetd -query localhost -once -geometry 1280x1024 -depth 24 # port = 5973 service vnc-1600x1200x24 protocol = tcp socket_type = stream wait = no user = nobody server = /usr/bin/Xvnc server_args = -inetd -query localhost -once -geometry 1600x1200 -depth 24 service vnc-640x480x32 protocol = tcp socket_type = stream wait = no user = nobody server = /usr/bin/Xvnc server_args = -inetd -query localhost -once -geometry 640x480 -depth 32 service vnc-800x600x32 protocol = tcp socket_type = stream wait = no user = nobody server = /usr/bin/Xvnc server_args = -inetd -query localhost -once -geometry 800x600 -depth 32 service vnc-1024x768x32 protocol = tcp socket_type = stream wait = no user = nobody server = /usr/bin/Xvnc server_args = -inetd -query localhost -once -geometry 1024x768 -depth 32 service vnc-1280x1024x32 protocol = tcp socket_type = stream wait = no user = nobody server = /usr/bin/Xvnc server_args = -inetd -query localhost -once -geometry 1280x1024 -depth 32 service vnc-1600x1200x32 protocol = tcp socket_type = stream wait = no user = nobody server = /usr/bin/Xvnc server_args = -inetd -query localhost -once -geometry 1600x1200 -depth 32
Avec la commande :
/etc/init.d/xinetd restart
Redémarrez ensuite le gestionnaire de session (gdm/kdm/xdm) avec la commande :
/etc/init.d/xdm restart
ce qui aura pour effet de redémarrer votre session graphique.
Pour tester vncviewer, lancez-le de la façon suivante :
vncviewer localhost :71
Cela ouvrira un session en 800x600x24bit.
Si vous voulez une autre résolution, utilisez les deux derniers numéros comme dans la fichier /etc/services
.