maandag, januari 23, 2006

VNC με SSH

Problem:

Θέλω να συνδέομαι από το PC στην δουλειά στο iBook που έχω στο σπίτι, χρησιμοποιώντας VNC μέσα από μια SSH σύνδεση για ασφάλεια. Ο VNC server στο iBook ακούει στην 5900.

Solution:

Στο PC πρέπει στο tunnel να δηλώσω σαν source port 5901 σαν destination port 5900 και σαν destination address localhost (ή 127.0.0.1). Με λίγα λόγια:

ssh username@router-ip-address -L 5901:localhost:5900

Μετά λέω στον VNC client να συνδεθεί στην localhost:5901 et voila.

Explanation:

(αντιγραφή από εδώ με μερικές αλλαγές)

A local forward is a tunnel from your local machine through the SSH server. You can create one on the command line by adding ssh arguments of the following form:

-L local_port:destination_host:destination_port

where the bits are defined as follows:

-L

Create a local forward (bind a local port, and forward it through the remote end.)

local_port

The port on the local machine that /usr/bin/ssh will listen on. This can be a port number or a service name like http, pop3, or mysql.

destination_host

The destination host (name or IP address) from the perspective of the SSH server. This can be a host that is not accessible at all from the SSH client.

Με άλλα λόγια αν θέλουμε να κάνουμε ένα tunnel προς το ίδιο μηχάνημα που τρέχει και ο SSH server δηλώνουμε localhost ως τον destination_host. Αυτό το "from the perspective of the SSH server" κάνει όλη τη δουλειά.

destination_port

The port on the destination_host to which it should connect.

Geen opmerkingen: