VNC (Virtual Network Computing) via ssh
Last modified on July 24, 2026 • 2 min read • 230 wordsI am sitting at home and want to use the GUI of my Linux at work.
ssh -L 5901:mcblpc2.hi.helsinki.fi:5901 mjeltsch@vesuri.helsinki.fivncviewer localhost:1To 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:1When 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:vncserverThis 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).