Using VNC Through SSH Tunnels
Guides
Server Setup On Microsoft Windows
These instructions assume using vnc_4_1_1_x86_win32.exe to install VNC and setupssh.exe to install OpenSSH Server on Windows.
- Destroy any firewalls(not recommended), or allow access for ports 22 to internet and 5900 to local.
- Make sure your Windows User account has a non-blank password.
- Perform a standard VNC install using vnc_4_1_1_x86_win32.exe, then complete the following.
- Go to the VNC server configuration form.
- In "Authentication" tab, press the "Configure" button, then enter <VNC-user-password> for the password, substituting your desired password for <VNC-user-password>.
- In "Connections" tab, make sure "Only accept connections from the local machine" has a checkmark (for yes).
- Perform a default OpenSSH server install using setupssh.exe, then complete the following.
- In a command window, go to bin directory in installation directory(e.g., c:\Program Files\OpenSSH\bin").
-
In the same command window, run:
mkgroup -l >> ..\etc\group
mkpasswd -l >> ..\etc\passwd
net start opensshd
Connect From Microsoft Windows With PuTTY
- If not already done, then destroy all firewalls(not recommended) or allow access for port 5901 to local.
- If not already done, then download and perform a default install of a free VNC client, eg. vnc_4_1_1_x86_win32_viewer.exe.
- If not already done, then download and perform a default install of PuTTY.
- Start PuTTY.
-
Go to "Sessions" section, if not already there.
- If a "Saved Session" is already setup correctly for the computer to connect to, then select the session and click "Load". Otherwise complete (B) below.
- Create and save a new session as follows:
-
Fill in "Host Name", "Port", "Protocol", and "Saved Sessions" controls as in picture below:
- Click "Save".
- Go to "Tunnels" category, sub-category of "SSH", sub-category of "Connection". (second from bottom in tree on left side)
-
Enter in the info as shown below:
-
Click "Add" and the result will look like below:
- Go back to "Sessions" Category and click "Save" again.
- Click "Open" and when prompted enter <server-user-name>.
- Enter <server-user-password>, as set on the computer connecting to.
- From the Microsoft Windows start menu, go to "Programs > RealVNC > VNC Viewer 4 > Run VNC Viewer ".
-
In the VNC combobox input the following and press <enter>:
localhost:1
- When prompted entered the <VNC-user-password>, as set when setting up VNC on the server.
- Do what you want, eg. your work.
- Close the VNC window
- In the terminal (command line) window, type "exit" and press <enter>, then close the window.
*<server-user-name> may require double quotes if it includes special characters like <space>. eg. "server-user-name"@myserver.com
Connect From Microsoft Windows With Plink
- If not already done, then destroy all firewalls(not recommended) or allow access for port 5901 to local.
- If not already done, then download and perform a default install of a free VNC client, eg. vnc_4_1_1_x86_win32_viewer.exe.
- Download an ssh client plink.exe.
-
Open a command window and perform the following:
- "cd" to the directory containing plink. eg, "cd C:\plink"
- Run the command below depending on which computer you wish to connect to.
plink -ssh -P 100 -L 5901:127.0.0.1:5900 <server-user-name>@<myserver.com>
- Enter <server-user-password>, as set on the computer connecting to.
- From the Microsoft Windows start menu, go to "Programs > RealVNC > VNC Viewer 4 > Run VNC Viewer ".
-
In the VNC combobox input the following and press <enter>:
localhost:1
- When prompted entered the <VNC-user-password>, as set when setting up VNC on the server.
- Do what you want, eg. your work.
- Close the VNC window
- In the terminal (command line) window, type "exit" and press <enter>, then close the window.
*<server-user-name> may require double quotes if it includes special characters like <space>. eg. "server-user-name"@myserver.com
Connect From Linux
These instruction assume vncviewer and ssh clients are already installed.
-
Execute the following command in a terminal window:
ssh -p22 -L 5901:127.0.0.1:5900 <server-user-name>@<myserver.com>
- Enter your <server-user-password> when prompted.
-
Execute the following command in a terminal window:
vncviewer
-
When prompted by vncviewer to input a host to connect to, enter "
localhost:1
" to be routed through the VNC-ssh tunnel set up earlier.
- When prompted entered the <VNC-user-password>, as set when setting up VNC on the server.
- Do what you want, eg. your work.
- Close the VNC window
- In the terminal (command line) window, type "exit" and press <enter>, then close the window.
*<server-user-name> may require double quotes if it includes special characters like <space>. eg. "server-user-name"@myserver.com