This shows you the differences between two versions of the page.
vnc_over_ssh [2008/05/17 12:35] adam created |
vnc_over_ssh [2016/11/25 22:38] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Using VNC Over SSH ===== | ||
- | ==== Setting it up for the first time ==== | ||
- | |||
- | * Install vncserver on the destination machine. | ||
- | * Run vncserver once and note the session number given (:1 if nobody else is using VNC on the machine). It will ask you to create a vnc password so do so. Example (minus the password part): | ||
- | |||
- | [adam@xen01 ~]$ vncserver | ||
- | | ||
- | New ' | ||
- | | ||
- | Starting applications specified in / | ||
- | Log file is / | ||
- | |||
- | (Note, if another VNC session is already running on the target machine, your session might :2, :3 or :x, where x is the number of your session as shown above). | ||
- | |||
- | * Kill the vncserver, with: | ||
- | |||
- | vncserver -kill :1 | ||
- | where :1 is your session ID. | ||
- | * Now go into your ~/.vnc directory while on the remote machine and edit the xstartup file | ||
- | * Comment out the xterm and twm lines and place: | ||
- | |||
- | gnome-session & | ||
- | at the bottom. Now log out. | ||
- | |||
- | Of course the Gnome Desktop environment needs to be installed for this to work. | ||
- | |||
- | ==== Using VNC over SSH for real ==== | ||
- | |||
- | Now that all the background stuff is done, you can use it for real. | ||
- | |||
- | * On your local machine start an SSH redirection over the VNC ports to the destination machine as follows: | ||
- | |||
- | [adam@localhost ~]$ ssh -C -L 5901: | ||
- | |||
- | (Note, if another VNC session is already running on the target machine, then the second 5901 needs to be 590x, where x is the number of your session as shown in the first section). | ||
- | |||
- | This creates a port redirection from the VNC port on your local machine to the VNC port on the remote machine, using SSH as an encrypted tunnel and gives you an SSH shell. Ignore the SSH shell for now, or use it as you need, but don't log out of it until you're finished with your VNC connection. | ||
- | * Start vncserver in your SSH shell as above and note the session ID. | ||
- | * To connect using a VNC client, tell your client to connect to localhost: | ||
- | * To end your VNC session, just close the VNC window. | ||
- | * To close the vncserver, just do '' | ||
- | * To kill the port redirection, |