All posts by redbug

VNC Securisé

J’ai de temps en temps besoin d’accéder à mon X à la maison à partir du boulot.
Mais il y a juste un petit problème: mon firewall ne laisse passer que SSH.
Voilà donc un petit script bash qui lance x11vnc à distance, récupère le port du serveur vnc, crée un tunnel ssh entre le bureau et la maison et lancer le client vnc.
Tout automatique 🙂

#!/bin/bash

port=`ssh jolan "killall x11vnc ; x11vnc -display :0 -bg -q" | grep PORT | sed -e 's/PORT=//' `

ssh -N -L $port:localhost:$port jolan &
pid=$!

sleep 5

vncviewer -encodings tight -bgr localhost::$port

kill -9 $pid

Il y a juste le ‘sleep 5′ qui m’embète.