Using TightVNC
From SUSE Wiki
Type: Howto, Application-Specific (TightVNC)
Tested Versions: 9.0
Written By: Unknown
Further Modifications By: No One
| This article has not been tested to work on the latest full release version (i.e 9 or 10, not 10.0 or 10.1) of SUSE Linux. You can help SUSE Wiki by testing this and updating the article where possible. |
| This article is in need of a cleanup. You can help SUSE Wiki by editing it to conform to the Article and Design Guidelines |
I hadn't played with tightVNC until now, opting to do all remote
administration via ssh. After going through the learning process, I got to
say "it's pretty cool." Now mind you, I still prefer ssh and the CLI from a
speed standpoint, but if you want your whole desktop in front of you, VNC is
the way to go. It's really not that bad on speed either.
Now for what it is worth here is the lowdown:
First, I wanted to get my local Suse 9.0 headless server's kde display up on my Win XP laptop. My server is named 'skyline'. Didn't seem like a tough thing to do. And it really wasn't. The steps were:
(1) make sure you have vncserver installed;
then start the server for the first time to set passwords and create initial config files
(2) create the initial ~/.vnc/xstartup file and sets the password
skyline:~> vncserver -geometry 1024x768 -depth 16 :1
kill the server and set the default display manager to kde or your preferred manager
vncserver -kill :1
(4) the default display manager is twm, (on SuSE) so you need to edit ~/.vnc/xstartup and replace 'twm' with 'startkde'. Interestingly on mandriva, you get kde as default.
now just restart the server:
vncserver -geometry 1024x768 -depth 16 :1
next, go get a windows based vnc viewer (Realvnc or tightvnc will both work)
(6) start the viewer; enter 'host:display' or 'host::port' in the box ( 'skyline:1' in my case), you will be prompted for the password, and you are done! If your not prompted for a password, revisit 1-5 above, try killing vncserver, and check with ps ax for any stray X process, kill them, restart vncserver again and try again. Also after you finish a vnc session, it isn't uncommon to have to ssh back into the server, kill the vncserver session you left and then restart it before another vncsession will display. You can log into the session, but it just gives you a grey screen.
Also, I have found -depth 16 is fine over a 1024/128 cable connection for remote sessions and -depth 24 is great for local connections.
Now for the fun. At home I had basically a direct connection to the vnc connection. I wanted to try and tunnel this over ssh to the 3 linux boxes at work and get their displays up as well. At work, the router forwards ssh to 'nemesis' an old mdk 7.2 box (no X) from which I can then get to 'bonza' a mandriva 2005LE box and 'rankin-xp' a Suse 9.3 box. Getting there required a little thought and a few tricks from ssh, but is all works.
With my basic set up at home, display 1 was already running, so port 5901 was in use in 'skyline'. To get around this problem ssh allows you to forward a remote port to a different local port - say 5902 which allowed a second vnc connection to display 2 on 'skyline' that was actually a local forward of display 1 on 'bonza' or 'rankin-xp' at work. The trick to get ssh to do this was to ssh into 'skyline' and then create a tunnel to 'nemesis' and tell 'nemesis' for forward port 5901 from either 'bonza' or 'rankin-xp' back to 'skyline' on port 5902 over ssh so it could be viewed as 'skyline:2' (display 2) on my XP laptop. After setting up vncserver on 'bonza' and 'rankin-xp' it actually worked. All it took was an ssh session via putty to skyline from windows. Then from skyline:
ssh -g -L 5902:bonza:5901 nemesis
and then in XP simply start another viewer session and point it to skyline:2, and your there. For grins, and in theory, you can set another display at 5903 and have 3 active vnc connections and 3 linux desktops on your XP box at the same time. (Now that's a great use of windows.....)
Now, I have also learned another shortcut in putty that will allow you to
ssh directly into a remote machine (nemesis in my case) from within windows and
access the display on any other machine on the remote lan in one step (or
SSH session as that may be). The trick in putty is the 'tunnels'
configuration tab. (forget the X11 tab, I have found no use for it) In the
tunnels tab, check the Local and Remote port check boxes. In the source port
enter the port (5901, etc) you want to talk to locally on the windows box.
For any machine on the remote lan, in the Destination entry, enter host:port
for the host and port you want to talk to (bonza:5901 in my case) and fire
up the ssh connection to whatever the visible server on the remote lan is.
Then just point tightvnc viewer or realvnc viewer at 'localhost:5901' on the
windows box and magically an X session from the remote machine will appear
via the tunnel you have created with putty.
<*note*>
If you do it this way, make sure you tell putty to compress the data sent and received. Some vnc viewers assume a connection to 'localhost:display' is always local and pass raw display data instead of applying any kind of compression.
</*note*>
Oh well, I found it cool. So for what it is worth, I thought I would share the information in hopes that it helps some other poor soul -- before I forgot what it was I did to get it working ; -)
Useful links were:
http://www.uk.research.att.com/archive/vnc/sshvnc.html http://www.uk.research.att.com/archive/vnc/sshwin.html http://www.uk.research.att.com/archive/vnc/xvnc.html http://the.earth.li/~sgtatham/putty/0.58/htmldoc/Chapter4.html#config-ssh-portfwd

