I am sitting at home and want to use the GUI of my Linux at work. But my work computer which is running the VNC server (mcblpc2.hi.helsinki.fi) is behind the University firewall. The only connection I can get into the firewall is via one of the university mainframes, e.g. vesuri.helsinki.fi. In order to connect using VNC, I need just two commands:
ssh -L 5901:mcblpc2.hi.helsinki.fi:5901 email@example.com
To make the connection faster, you can use compression (helps only if you have a slow connection, e.g. a modem). When using VNC with ssh, the vncviewer really thinks you make a connection to the local machine and therefore chooses a wrong encoding. So the second command actually should be:
vncviewer localhost:1 -compresslevel 0 -encodings "copyrect hextile"
When you run the vncserver on a computer that has its own firewall, you need to have sshd running and to open the ssh port (22). Then you establish a tunnel from that ssh server on that computer to a port on your local computer:
ssh -L 5901:remotemachine:5901 username@remotemachine vncviewer localhost:1
When you run KDE desktop sharing on Suse 9.0, you share the physical screen (:0). Thus, if you are logged out, you cannot connect using desktop sharing. You have to start up additionally a vnvserver instance:
This server will use by default the :1 session and that's why the forwarded port must be 5901 and not 5900 (like for the first session).