Installing SSH server on Windows 2003 using CopSSH.

This is a short guide on how to install SSH server in Windows operating system.

SSH is an abbreviation from Secure Shell. You can read a decent article about SSH on Wikipedia.org.

SSH is a convenient protocol for secure communications. It supports port tunneling, file transfer (through SCP or SFTP), remote console.

We ll implement SSH server using CopSSH server, which a combination of Cygwin and OpenSSH software. Cygwin is an emulator of UNIX environment for Windows. It allows running software originally developed for UNIX such as OpenSSH. OpenSSH is a free server/client available for Linux/UNIX/BSD systems. It is stable and reliable. CopSSH is free while SSH Software and Globalscape offer their implementations of SSH server for Windows which cost as much as 600$ to 1500$.

So here we go:

  • Download the latest CopSSH archive with installer from official CopSSH site. Make sure you download the latest version. Here is the link to the archive: CopSSH 1.4 install archive at SourceForge.
  • Extract the installer from downloaded archive.
  • Execute the installer.
  • You can install CopSSH with default parameters (By clicking Next>Next>….Next>Finish :-))
  • After your installation has been completed you have your SSH server running however there are no users that can access this server.
  • In order to allow the user to access the system through SSH you need to activate this user using wizard installed.
  • Start>Programs>COPSSH>01.Activate a user

Menu.JPG

  • When the wizard starts you ll be presented with a screen where you have to choose various options for user activation.

Activation.JPG

  • You have to choose the name of the user you want to activate from drop down menu on the left (this user must be created before hand in windows)
  • You have to choose the type of the shell what user would have: if you want to give your user a proper console accessible via SSH client a chance to use you should assign /bin/bash/ (users will have SCP and SFTP access as well if this one is selected), if you want to give an option of SFTP transfer only you should select /bin/sftponly. /bin/false will deny access to ssh shell.
  • You can select other options depending on your requirements. You can safely deselect all of them or leave them enabled. BTW, if you using public keys you can authenticate and there is no need for passwords.
  • After you selected required options click NEXT. You ll see a message saying that user has been activated.
  • Now this user can connect via SSH client such as PuTTY or WinSCP (this is an SFTP client)

If you decide that you dont want the user to access your server via SSH you can use “02.Deactive a user” wizard.

/etc/passwd file

When user accesses the SSH server via SSH or SFTP he/she ends up in a default folder also known as home directory. Home directory setting is controlled from the passwd file. This file is located in \etc folder of your CopSSH install ( the default is C:\Program Files\CopSSH\). Here is a sample from this folder:

userX:unused_by_nt/2000/xp:1009:545:U-TXC\user,S-1-5-21-408-3526579081-1183671420-1009:/cygdrive/d/web/www:/bin/sftponly

let me explain the meaning of various parameters mentioned in this file:

userX means the username used by particular person to login

/cygdrive/d/web/www is the default home directory of the particular user. Please note that by default CopSSH assigns home directory as /home/username , but you can amend it to meet your requirements. CopSSH does not support Windows style paths so you have to translate your windows paths. For example /cygdrive/d/web/www actually matches D:\web\www folder. Based on this you can easily convert any windows path into path usable by CopSSH.

/bin/sftponly is the type of shell that is available for particular user. In this example it is set to be sftponly, i.e. user can access only secure file transfer service. You can set it to /bin/bash (for console access) or /bin/false (for no access at all)

Troubleshooting

You can test availability of CopSSH service by telnetting to port 22 (by default). You can type this command from console on the server where CopSSH is installed:

telnet 127.0.0.1 22

You should get this reply:

SSH-2.0-OpenSSH_4.4

This reply might differ depending on the version of CopSSH you installed.

If you dont get the reply you might need to check whether OpenSSH service is running in the list of Windows services. If it is running you might have a problem with your firewall.

You might change a number of parameters for your SSH service by editing sshd_config file located in etc folder of CopSSH install. For example you can change port used by the service to a different value by changing Port option in sshd_config. In order to apply your changes you need to restart OpenSSH service in Windows services.


Technorati : , ,
Del.icio.us : , ,
Ice Rocket : , ,

About The Author

Leave a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top