Posted by: sysblog | Monday, 7th Jan 2008

Ubuntu: Connect to your Windows machine securely using VNC and SSH with little installation

This will show what needs to be set-up and installed to use a secure line from a Linux box (eg. Ubuntu) to a Windows box via SSH-tunneled VNC but without the load of Cygwin installed on Windows. I used the nicely small package SSHWindows.

SSH server for Windows (on Windows machine)

  1. Download SSHWindows and run the installer. An alternative could be WinSSHD from bitvise. It’s 30 days trail and closed, though. You’ll be prompted with the warning to edit the passwd file. Read quickinstall.txt or readme.txt for more details located in the install folder for %PROGRAMFILES%\OpenSSH\docs (hit WIN-KEY+R and copy&paste the path there for quick access).
  2. From a prompt cd to %PROGRAMFILES%\OpenSSH\bin. (WIN+R and type cmd, hit ENTER, c: ENTER, cd %PROGRAMFILES%\OpenSSH\bin)
  3. Run the following (replace <username> with the Windows username that should log in from Ubuntu):
    mkgroup -l >> ..\etc\group
    mkpasswd -l -u <username> >> ..\etc\passwd
  4. Start opensshd as Windows service:
    net start opensshd
  5. Open incoming port in Windows firewall:
    netsh firewall add portopening TCP 22 "OpenSSHd"
    The “OpenSSHd” bit can be chosen individually; it’s only a string to identify this entry.
  6. Test login locally with eg. PuTTY and than test it from the Linux box (ssh winuser@winip). You might need to do some firewall (Windows and/or iptable) config. If your Linux box has to go through some kind of router/firewall machine you’ll most likely have to add port forwarding on that firewall to pass port 22 (SSH port) to the windows machine’s IP.

Install TightVNC (on Windows machine):

  1. Don’t forgett to click the options to setup VNCServer as Windows service and start it after installation.
  2. Open TCP port 5900 temporarily for testing like for opensshd:
    netsh firewall add portopening TCP 5900 "VNCincoming"
  3. Test it from Ubuntu with vncviewer <windows-machine-ip>
  4. If it works close the port in Windows firewall. You won’t need that hole any longer:
    netsh firewall delete portopening TCP 5900
  • Configure tunneling VNC through SSH (on Linux box):
  1. ssh -L <local port>:<remote computer>:<remote port> <user>@<remote ip> and vncviewer 127.0.0.1
  2. Test vnc connection again using -via option: vncviewer -via user@host localhost:0
  • Use compression in ssh?
  • GNOME applet/shell skript?

References:

Comments are closed.

Categories