If you want to set up an SFTP server for windows and you are not looking for serious options, after some searching you would end up with installing Freesshd, a freeware SFTP server installer. Freesshd has been last updated in 2009 and is an orphan now. (Nobody cares if you have a problem working with it.)
Setting up SFTP server in windows OS is a pain, especially if you go with command line installations such as CYGWIN Openssh. Believe me, you need to spend some hours without results. Somehow i was unable to make Openssh work on my server. So, when I looked at other choices, within the deadline I had, had to choose freesshd for a test (not serious) SFTP server setup. It has a GUI for configuring the server options, which makes our life easier.
How to Configure
Installing Freesshd is walk in the park. don't wait, just go on selecting blah blah blah, as you do for all desktop app installations.
- It would ask you to whether generate private keys, click 'Yes'. These would create host keys for authenticating your server (different from user authentication public keys) to avoid man-in-the-middle attacks when your client accesses it.
- It would ask you if it needs to be installed as a windows service. If you click No, that means you will only allow users to access you SFTP server, when the application is running. i.e., When you close the freesshd application, the SFTP server goes down. If you click Yes (preferable option), the sshd service will be running with your desktop. i.e, users can connect to your SFTP server, even after system restarts.
Here comes the tricky part, well some what. You must be having a freesshd shortcut icon on your desktop now. If not, look in start menu->all programs -> freesshd. Upon clicking it, you will be prompted with a gratitude message. After accepting it, look for the same icon in right down corner tray (date-time tray). Again, click on it.
You would be displayed with FreeSSHD settings window, with "Server Status" tab opened. If you see a cross mark against SSH server, that means your SSH server is running as a windows service and don't worry about it. If you chose not to run it as a windows service while installing, then you must start it by "Click here to Start".
I am just concerned about SFTP server here. so, i will be skipping all other settings.
Switch on to "SSH" tab. Listen Address - Select your machine IP address and leave everything as they are.
Switch on to "Authentication" tab. this tab defines which authentication methods you would use for client authentication. That could be Password, Public key or both. It is good idea to use both.
- Public key folder is where your public keys for each user resides. By default, it will be C:\Program Files\freeSSHd\. It is good to create a new folder in that path, such as "Keys" for better administration. Select the new created folder path now. So, you have to place public keys for each user in C:\Program Files\freeSSHd\Keys (covered later).
- Select the password authentication as disabled, if you don't want to have that. if not, select required or allowed.
- Select the public key authentication as disabled, if you don't want to have that. if not, select required or allowed.
Switch on to SFTP tab. Select a root SFTP directory, which your users can access.
Switch on to Users tab. Click on 'Add' to create virtual users. Give it a name. Here you can specify how each user is authenticated whether via windows login, or Password or public key. You can give each of them permissions to use Shell, SFTP and/or tunneling.
Switch on to Logging tab and check "Log Events" box which is useful to debug the failure cases.
Go to C:\Program Files\freeSSHd\Keys folder. Create a new text file and place your public key in one line removing all the comments. Save the file with exact username and without any extension.
Now, Click on Apply and OK. Right click on Tray icon, and click on "Unload" and open desktop shortcut again, to take the changes effect . It is better to restart service (Run -> services.msc ->freesshd) as well, if you are running one.
Now, you can connect to the SFTP server using any clients such as WinSCP, PUTTY. Note that for Publick key authentication, you have to import your private key to SFTP client.
Still not working, make it work
Well, issues you may fall into are quite general.
- You can't start ssh server through freesshd window ---> Stop the freesshd windows service in run ->services.msc. Start ssh server in window and start service again
- Your client can't even make a connection ---> make sure that icon is in the tray or freesshd service is running. Make sure that correct IP address is configured in SSH listening address.
- Your client connects but returns some error. Go to C:\Program Files\freeSSHd\freesshd.log and see the error message. If it is bad key error, that means you didn't configure public key correctly. Check the path in "Authentication". Check the public key file given in the path, if it has same name as username. finally check the public key once again. After any change, don't forget to unload and load tray icon.
- Could be more here....
Freesshd is simple and perfect for setting up test SFTP server. But, it has it's own pitfalls regarding security as it is no longer taken care by it's creators. I have come across another good GUI SFTP setup software, Bitvisessh server. Bitvise presents more options and is more robust. If you want to use it for commercial purpose, you should buy the license.