Schurger.org

29 mai 2006

Running an SSH server on Windows

Filed under: SSH — Jean Schurger @ 16:35

Here is a quick how to about running an SSH server on a Windows PC.

1. Intro : Any reason do do this nasty thing : YES, it allow you to have a command prompt, that sometimes can be usefull for who knows how to admin Windows box from a shell, and the most important (i think), it’s that SSH tunnels works well (i dunno, if there is an stunnel server of Windows, but this way is very simple and works well).

2. The Software

It uses a version of cygwin compiled openssh specialy packaged for that. WARNING, it may conflict with a normal cygwin installation, but in that case, you don’t need this version.

You can found it here : http://sshwindows.sf.net

3. Install it and folow the quick start (it’s on the Start-Menu) or the even-more-quick start below

  • Install it (i guess you know how to do that. A Zip file with an exe within is provided for the install)
  • Open a shell (you know, the “cmd“)
  • chdir in the installed directory
  • cd c:\progra~1
    cd openssh*
    cd bin

  • create the group and passwd file as explain in the quick start
  • mkgroup -l >>../etc/group
    mkpasswd -l >>../etc/passwd

  • Then, stard it
  • net start opensshd

  • WARNING : to be able to login, you MUST have a password set for the account you want to use.
  • That’s finished, now you can login on your Windows Box, and get the cmd prompt.

ssh Administrateur@my_windows_box_ip

4. Tunnels are working

Imagine you have an VNC serveur on a Windows Box that is hidden behind a firewall. Just open the SSH port (22) to you Windows PC, and you’ll be able to connect to your VNC throug the SSH tunnel. (very more secure than opening your VNC server to the world !).

  • From Linux

$ ssh Administrateur@my_windows_box_ip -L 5900:localhost:5900
$ vncviewer localhost

  • From Windows
  • The Putty SSH client allow to make tunnels. Here is a screenshot :

Putty Screenshot

    Add the tunnel as in the picture, (you should have entered the right IP in the Session section), and click open.Keep the connection opened somewhere, and just connect with your favorite VNC client to the adress 127.0.0.1..done;

Powered by WordPress