View Full Version : vnc & ssh

9th May 2006, 09:13 PM
Hi All,

I can't get vncserver working with ssh. I can logon with putty but when I attempt to manually start vncserver it fails (shows in it's log) saying that /usr/bin/xsetroot unable to open display ':1' and xrdb: connection refused, xrdb: unable to open display ':1'.

I just know I've forgotten a step here or two.....


9th May 2006, 09:45 PM
If you see my server setup howto (signature link), it shows you a way of setting up VNC & GDM that works very well. From there, you can use a command like:

ssh -p [ port # ] -l [ user ] -R [ to_port ]:localhost:[ from_port ] [ host_to_connect_to ]
to connect. In my case, for example, it would be:

ssh -l username -p ### -R 5905:localhost:5900 firewing1.homelinux.net
That would map port 5900 on firewing1.homelinux.net to 5905 on localhost, enabling me to do
vncviewer localhost:5

9th May 2006, 10:53 PM
I'm not sure what's in Firewing's todo, but if you edit /etc/sysconfig/vncservers, uncomment/edit the two lines at the bottom, set a vncpassword, then "service vncserver start" will take care of running the server for you. I think I remember seeing instructions on the vnc password on Firewing's site, or somewhere.

If you have vncserver on your local linux box, "vncviewer -via remoteipaddress :2" will fire up the ssh connection with the appropriate tunnels for you and connect to the remote vncserver process on the localbox. In fact "vncviewer -via sshhost othervncmachine:0" will connect you to a vncserver on a different host. If you are using vncviewer from a windows box, you do not have that luxury and need to follow FW's instructions.

9th May 2006, 11:35 PM
Must of been someone else, I never use the "vncserver" method, always the "VNC & GDM" method as it's more secure and will let any user login given they have a account and password, not just yours. Not to mention that "vncpassword" stored your password plaintext, which is NEVER a good thing.

11th May 2006, 12:20 PM
Hi Firewing1,

One thing I've always known about unix / linux is the more you use the product the more things you didn't know existed in it.

What is GDM and it's use with VNC ? Also thanks for the detailed walkthroughs. What I've done is use the default settings with putty to remotely logon the server ( ssh 22 ). Then from the login directory I execute vncserver to start it up and it's configured to use 5901. The from the desktop I point the vncviewer to xxx.xxx.xxx:5901. Is that a secure way to remotely admin or is your way the better ?

thanks again,

11th May 2006, 01:13 PM
I prefer freeNX over VNC. It's incredibly fast and quite easy to setup to use ssh.


11th May 2006, 04:36 PM
I just set up freeNX and it does seem quite a bit snappier than VNC over work's T1.

11th May 2006, 06:34 PM
It's faster once you're connected, but it definitely takes about 5 times as long to attach. I've been disconnected twice already, that's a cramp. It seems to get a little flakey when reconnecting to a suspended connection, so I've had to kill and restart it a couple of times. The dynamic desktop resizing is nice.

Overall, since I use VNC only to do administration stuff I can't (or choose not to) do from the command line or by throwing my xclient onto the local display, the little quirks in reliability and connection speed outweigh the slight performance increase. I'll stick with VNC until I need the benefits of NX.