(linux_command_line)-> persistant vnc remote xsession over ssh setup
submited by Russell Fri 23 Dec 05|
Edited Thu 18 Oct 07
Now if all you want to do is to open a remote xsession, you can use ssh with the -X option witch forwards xpackets for you:
ssh -X remote-host
Last login: Wed Mar 1 17:54:34 2006 from 192.168.0.40
[username@remote-host ~]$xload &
Should open the xload program in a new window on the local machine.
I have found this workable but really slow, even when both ends of the line are high-speed cable connections. I suspect that it's the latency that makes is so sluggish. If you want do to a lot of work with an xsession you should use a vncserver and vnc-client/viewer. This vastly improves the connection, economizes the connection where it can, and at times seems as good as if I was sitting locally at the remote host. To Setup VNC:
On server: ( machine you want to connect to)
Then on the client. ( machine you want to connect from)
yum install vnc-server
add lines :
VNCSERVERARGS="-geometry 1024x768 -depth 16"
for each user you want to access the server:
then set the passwords:
as each user: (you must do this before starting the server)
(set vnc password)
then start the server(as root or with sudo privliges):
(starts xsession for each user)
The client ( I think this varys from client to client) will do a speed test on first connection and adjust the color level to match the bandwidth. The Linux client (vncviewer) seems to adjust the color level dynamicly.
yum install vnc
ssh -f -L 25901:127.0.0.1:5901 username@domain sleep 10; vncviewer 127.0.0.1:25901:1
enter the ssh password
enter the vncpassword
The default window manager is twm , which is awkward to use if you are not familar with it.
the session is persistant across lost connections and changes in client machine.
to change to a better window manager: (mwm is part of openmotif: yum install openmotif ... lesstif-mwm in newer fedoras)
killall -9 twm ; mwm &
Of course, a beter solution is to edit ~/.vnc/xstartup (created when you start the vncserver for the first time) so the last line is mwm
setup instructions for vnc over ssh client under windows
That page gives wrong port forwarding settings, I used,and got this working with setting port 5901 (local) tunneled to 127.0.0.1:5901 . I think the example they give will work if the remote host is not behind a firewall. Since only ssh is open to my server, I need to use 127.0.0.1 ( localhost) as the address at the end of the tunnel.
Either solution ( ssh -X , or vncviewer) will work over or thru a firewall as long as some port (normaly 22 ) is open to allow the ssh connection.
A couple of notes on common problems:
- If you don't set the user's password the server will fail to start
- Default firewall will block connections , either use the ssh trick above or change the firewall to permit connecitons on the selected port. A blocked connection yeilds a odd error message
main: unable to connect to host: No route to host (113)
Personaly I think the message should be "connection refused" because this message doesn't clue you in to the problem being the firewall.
- Port number is 5900 plus server number
Add comment or question...: