Setting up a SFTP Server on Windows

I recently had to create an SFTP server on our work development system, and after doing a fair bit of Googling on the topic found a good solution. The solution is a combination of research done at differnt sites. It is this solution that I am sharing in hopes that it will help someone else.

This tutorial will help you turn your Windows based system into a SecureFTP server.

Background

Secure Shell (SSH) is a program that lets you log into another computer over a network, to execute commands in a remote machine, and to move files from one machine to another. It provides strong authentication and secure communications over insecure channels. When using ssh, the entire login session, including transmission of password, is encrypted and therefore is very secure.

You may have noticed that many webhosts allow ssh access. This means that you can login to their webserver and execute many UNIX commands (the ones they allow you access to) on your account. Not only can you connect to other computers that provide SSH access, but you can also allow others to connect to your computer using SSH.

To take this one step further, you can also turn your Windows PC into a Secure FTP (SFTP) server. SFTP is a program that uses SSH to transfer files. Unlike standard FTP, it encrypts both commands and data, preventing passwords and sensitive information from being transmitted in clear text over the Internet. It is similar to FTP, but because it uses a different protocol, you must use a FTP client that supports SFTP (more about that later).

Installing SSH on Windows

Most UNIX based systems (Linux and OSX) come with SSH preinstalled, so connecting to a remote host is very easy. However, if you run a Windows system, you need to download some additional software to make the SSH programs available to you. Fortunately a free open-source project called SSHWindows, provides a nice Windows installer that will setup the SSH client and Server on your system.

Your first step will be to download the Binary Installer Release from SSHWindows. Once downloaded, run the installer and be sure to install both the client and server components.

Configure the SSH Server

In this next step, I have summarized the information that is included with the readme.txt that is included with SSHWindows (it can be found in c:\program files\openssh\docs)

Your first configuration step is to set up the passwd file. You will need to set up the passwd file before any logins can take place.

Passwd creation is relatively easy and can be done using two programs that are included with SSHWindows – mkgroup and mkpasswd. Both of these programs are located in the c:\program files\openssh\bin directory.

To begin creating the group and passwd files, open a command prompt window and navigate to the c:\program files\openssh directory.

You must first create a group file. To add all local groups on your computer to the group file, type the command as shown below:

mkgroup -l >> ..\etc\group

You will now need to create a passwd file. Any users in the passwd file will be able to log on with SSH. For this reason, it is recommended that you add users individually with the -u switch. To add a user to the passwd file type the command shown below:

mkpasswd -l -u username >> ..\etc\passwd

NOTE: the username specified above must be an existing windows login account.

Creating Home Directories for you Users

In the passwd file, you will notice that the user’s home directory is set as /home/username, with username being the name of the account. In the default install, the /home directory is set to the default profile directory for all users. This is usually c:\documents and settings.

If you want to change this location you will need to edit the passwd file. The passwd file is in plain text and can be edited in Notepad or any text editor. The last two entries for each user are safe to edit by hand. The second to last entry (/home/username) can be replaced with any other directory to act as that user’s home directory. It’s worth noting that when you run SSH on windows, you are actually running SSH in a scaled down version of cygwin, which is a Unix emulator for Windows. So, if you will be placing the user somewhere outside the default directory for their Windows profile, you will need to use the cygdrive notation.

To access any folder on any drive letter, add /cygdrive/DRIVELETTER/ at the beginning of the folder path. As an example, to access the winnt\system32 directory on the *c:* drive you would use the path:

*/cygdrive/c/winnt/system32*

Connecting to your SFTP Server

To connect to your new SFTP server, you will need to download an FTP client that supports SFTP. I use Filezilla which is a nice free FTP and SFTP client. You might also try WinSCP which is another free SFTP client.

To test if your server is running, create a new connection in your client and specify SFTP as the server type, 22 as the port, and localhost or 127.0.0.1 as the server name. You will also need to provide the user account and password for any account that you added to your passwd file. Now connect to the server. If all went well, you should see a directory listing where you pointed the home folder to. If not, there are a couple of things to check. Make sure your Windows firewall is set to allow traffic over port 22 and finally double check your passwd file to make sure that the account you added is actually there.

Security

Because SSH allows access to only Windows user accounts, you can restrict access based upon NTFS file permissions. As such, SFTP does not provide for chroot jails (a Unix method for locking a user to his/her home directory). Simply lock down your filesystem for that user, and SFTP will respect that.

Summary

In the end, setting up an SFTP server turned out to be a very effortless task. With a couple of open source programs and a couple of command-line commands, you can up and running in no time at all!

125 Responses to “Setting up a SFTP Server on Windows”

  1. pete said on July 5th, 2005 at 2:18 pm

    i cant find this passwd file and it wont connect

  2. Marcel said on July 21st, 2005 at 12:12 pm

    I have followed all the instructions and have succesfully installed ssh and filezilla however I don’t really get the last part where you say create a new client connection and specify it where is this done at, my server wont let me connect to it

  3. Mike said on July 29th, 2005 at 8:18 am

    Great instructions. The only thing I would add is to check to make sure the service is running after the installation. Otherwise everything worked perfectly.

  4. Greg said on August 17th, 2005 at 10:23 am

    Doesn’t look like the Binary installer installed the services. How do I install the sshd service?

  5. Adrain said on August 19th, 2005 at 4:11 am

    Thx!!! Works perfect.

  6. Chris said on September 10th, 2005 at 1:18 pm

    Works great but the download transmission speed is considerably slower than normal http://FTP. For instance, I can download at 120kbs via FTP but only around 90kbs with SFTP. Is there a way to speed this up?

  7. Joshua Strickland said on September 30th, 2005 at 8:21 am

    Having trouble getting the binary installer to download. Anyone know of any mirror sites or have a copy? Email me please.

  8. moe said on November 3rd, 2005 at 7:32 am

    Great instructions. But I keep getting the error below.
    Any ideas what I missed?
    Thanks
    Status: Connecting to localhost:22 …
    Status: Connected with localhost:22. Waiting for welcome message…
    Response: SSH-2.0-OpenSSH_3.8.1p1
    Error: Timeout detected!
    Error: Unable to connect!
    Status: Waiting to retry… (5 retries left)

  9. Roberto said on November 11th, 2005 at 5:03 am

    Hi, I’m trying to download the sshwindows from sourceforge but it only shows me an error, if anyone have it, please shared me, this is my email moroli@hotmail.com
    Thanks a lot!
    Rob

  10. Ioset Hundsdorfer said on December 4th, 2005 at 12:35 pm

    LOOK AT THIS LINK

    Setting up a SFTP Serv…

  11. boot said on December 11th, 2005 at 10:51 pm

    dont know if im alone on this but when i was walking through the steps and got to the mkgroup and mkpasswd part i read

    mkgroup -l ..etcgroup
    instead of
    mkgroup -l ..\etc\group

    just thought i would let you know as it took me a few minutes and a look at the readme.txt before i could figure out why the commands werent working.

    thanks for this install guide it helped me a lot!

  12. Sean D said on December 13th, 2005 at 3:51 pm

    EXCELLENT instructions. The only issues I had were inserting the \ characters in the mkgroup and mkpass filenames like ..\etc\passwd and I did have to reboot.

    This was a great help. Thanks.

  13. Amaury Fernández said on December 18th, 2005 at 2:59 pm

    Excellent instructions, but i’m have problem with connect. When i try connect with putty generate the fellow error:

    ‘Network error: Software caused connection abort’

    but, when a run openssh high debug mode all run OK.

  14. Farhad said on December 23rd, 2005 at 1:53 pm

    Great Great Help. Just some things to add:
    1) The \ characters are missing for \etc\group and \etc\passwd
    2) to start the ssh service you must type “net start opensshd”
    3) to end the ssh service for windows type “net stop opensshd”
    4) those people who are getting the error timeout detected! and unable to connect! they MUST create a password for their windows login account. If the windows login account does not have a password (normally many people have only one account without a password), then ssh server cannot be connected because it requires a passowrd

  15. Home Work said on December 31st, 2005 at 1:55 am

    I Came.. I Saw… I Posted :-)

    You Have Now Been Officially Graced With My Presence!

    Your Welcome,
    Working at home

  16. Sanjeev Shukla said on February 13th, 2006 at 8:01 pm

    This worked like a charm.

    Great article.

  17. Soltan Soheily said on February 14th, 2006 at 1:01 pm

    I am having the same problem Moe had.

    Response: SSH-2.0-OpenSSH_3.8.1p1
    Error: Timeout detected!
    Error: Unable to connect!
    Status: Waiting to retry… (5 retries left)

  18. lemasney.com » Blog Archive » links for 2006-02-16 said on February 16th, 2006 at 5:22 am

    […] Setting up a SFTP Server on Windows Setting up an SSH server on windows - a very useful article (tags: linux_and_open_source howto_references_tutorials_resources) […]

  19. Dish Network said on February 16th, 2006 at 10:45 am

    Peter from Tampa here. Is it possible to subscribe to this blogs rss?

  20. vbox408 said on February 24th, 2006 at 4:26 pm

    I can get the sftp working with public key authentication. How can I prevent user from using SSH command?

  21. Mark said on March 8th, 2006 at 9:44 am

    Perfect instructions - apart from having to start the service manually (although it was set to auto, a reboot thus would have also started it)

    thanks i really needed that

  22. John said on March 11th, 2006 at 10:30 am

    Yeah, wery good instructions to make a sftp server. It’s easy and free… but can someone tell me, if I can deny acces to FAT32 disk? On NTFS, its ok - I set the rights, and it works. But when user go to FAT32 disk, he has every rights. Can i solve it without converting this partition to NTFS?
    Thanks..

  23. Parth said on March 16th, 2006 at 5:14 am

    when i try to connect my ssh server i get this error :

    ssh: connect to host 10.102.18.21 port 22: Connection refused

  24. annamarie said on April 17th, 2006 at 10:19 am

    Nice web page! Very sharp. I agree, maybe I am crazy or maybe I am not. Make sure you post often.Great job.

  25. home based business said on April 18th, 2006 at 11:39 am

    Congrartulations on this most excellent Blog

  26. Webfork said on April 18th, 2006 at 6:13 pm

    Hey, do you know of a way to just get SSH to work with a regular FTP server? We’re really happy with the FTP server we’ve got but we want to be able to SSH into it. So far we’ve tried the included SSL in the software but no luck and the SSH “tunneling” associated with PuTTy is too complicated for some users. You would be my hero if you can just point me in a good direction over here. Thanks!

  27. chris chambers said on April 22nd, 2006 at 4:14 pm

    I am having trouble issuing the commands in the command prompt. keeps telling me a domain name is only accepted when minus d is provided. The commands arent clear..you dont have to put the >>.. charcters in do you? I dont fully understand the group users and stuff…someone please elaborate on these commands and how i am using them please…thxs in advance

  28. chris chambers said on April 22nd, 2006 at 4:23 pm

    when i try mkgroup -l usr\group
    response: a domain name is only accepted when -d is given
    when i try mkgroup -d usr\group
    response: cannot get PDC, code = 2453
    when i try mkpasswd -l i dont understand the output??
    when i try mkpasswd -l “windows username”
    response: the domain thing as said earlier
    when i try it with -d tells me it cannot find the domain controller.
    someone please help, i really require this service but have no idea whats wrong

  29. Nafai said on May 15th, 2006 at 1:52 pm

    A better and much easier setup than this is just to use copssh!

  30. kkkkoaaa said on May 26th, 2006 at 3:01 pm

    Keep a good job up!

  31. nottyboy said on May 28th, 2006 at 6:40 pm

    the guide is easy, but i still not able to set it up, and it crash my cygwin.

  32. Vin said on June 2nd, 2006 at 6:31 am

    I got the SSH up and running though for some weird reason it will only accept dos (telnet) commands and not SSH. Any suggestions?

  33. Al.Y said on June 19th, 2006 at 8:49 am

    I followed the installed and had no problem
    I am using XCeed component for .Net to connect to my FTP Site (which is my own PC)
    It is capable of SFTP, however I am getting an error while attemting to connect, the error is:
    The command socket was disconnected from the FTP server

    I can not use Port 22, so I am using 990 on my PC instead
    Please advice

  34. Willy Wangsa said on July 6th, 2006 at 8:45 am

    When login using SSH, the user can browse the entire directory. I wonder if we can restrict the folders to user home folder and subfolder only.
    I need suggestion. Thanks

  35. rhomb said on July 31st, 2006 at 7:23 pm

    Following error:

    Response: SSH-2.0-OpenSSH_3.8.1p1
    Error: Timeout detected!
    Error: Unable to connect!

    Can be solved by enabling SSH2 on your SFTP client. In FileZilla go into Site Manager and in the ServerType select: SFTP using SSH2

  36. GD said on August 9th, 2006 at 9:21 am

    Install went fine. However i can only get an account with administrative priveldges to login. Domain environment. anyone have similar problem?

  37. luwei said on August 17th, 2006 at 7:54 am

    hi i want to know about sftp client how to run ?
    in other words when the ssh receive a packet that is channel success,the next SSH should send a packet , i want to konw what the send packet?
    thanks!!!

  38. Kisho Shin said on September 1st, 2006 at 5:27 am

    Works fine!

    But it runs under a real linux more stable, faster and more secure …

  39. Mark said on September 8th, 2006 at 1:08 pm

    GREAT INSTRUCTIONS - THANK YOU. quick question.. after setting it up, I can connect on port 22 with SFTP using ssh2. I get the Yellow padlock indicating a secure connnection. question: is there any way to actually confirm that i have a secure connection? (my host tech support team tells me that their dedicated servers dont support SFTP using SSH2 but yet i am connecting and getting the padlock - so i am confused as to what is really going on). Would love some advice on this. thanks in advance.

  40. Edgar said on September 27th, 2006 at 8:16 pm

    SSH/SFTP was pretty easy to setup. However, locking it down has been a little more difficult. I’d like to create sftp_user accounts that allow them access to specific areas. I know. I can use ACLs to lock down directories. The problem is that I have only been able to connect with Administrator accounts, which I do not want to do. Has anyone had any luck creating non-admin accounts that can sFTP?

  41. Greg said on September 28th, 2006 at 8:28 am

    Problem is you have to all the user logon locally permissions.

  42. Matt P said on October 6th, 2006 at 11:26 pm

    When i use the mkgroup -l>>C:\program files\openssh\etc\group command i get a response that says:
    a domain name is only accepted when -d is given

    What am i doing wrong?

  43. Gabi said on November 17th, 2006 at 3:54 am

    I followed the installation proces and had no problem, only a question.

    Under Windows 2003 event viewer, appear a sshd event ID 0: Accepted password for “username” from “IP” port XXXX ssh2, is possible hide this event ?

    Thanks

  44. ray said on November 19th, 2006 at 8:21 pm

    Hi.

    I’m trying to set up a SFTP Server. I followed your instructions but I get the same error when creating passwd file, a domain name is only accepted when -d is given. what does that mean? Am I doing something wrong?

    please help me. and what is the easiet to setup sftp using ssh for windows 2003 server?

    thanks.

  45. Gabi said on November 20th, 2006 at 4:51 am

    Ray,

    Caution with spaces, review the Quick Start Guide in Start\Programs\OpenSSH for Windows

    mkpasswd -l -u username >> ..\etc\passwd

    I am upgrading cygsrv, cygutils and openssh packages and DLL’s over OPENSSH for Windows 2003, and all its OK.

  46. Gabi said on November 20th, 2006 at 4:54 am

    Error:

    Introduce ..\etc\passwd in the article appears ..\etcpasswd

  47. celebrity morgue said on December 4th, 2006 at 4:52 am

    URMXP Packages & Downloads *NEW*

  48. Caio Barba Andrade said on December 8th, 2006 at 10:58 am

    Thank you!!!

    This solution is great.

    I have just implemented it to solve a file transfer issue.

  49. Geoffrey Moore said on December 18th, 2006 at 11:18 am

    Fantastic article. Thanks!

  50. Rob said on December 27th, 2006 at 2:23 pm

    Good article to put all the information together. I’m working on trying to lock down permissions, but overall your summarized instructions works. Thanks. — brickwalls19(at)gmail[dot]com

  51. Andy said on December 31st, 2006 at 2:57 pm

    Great article. I’m having problems trying to connect through a NAT connection. Filezilla is adding my external IP address to the username and it will only accept it under the internal username. IE username@192.168.1.11 works… when it adds username@192.168.1.11@externalip it doesn’t. I assume this is a setting in Filezilla…

  52. Andy said on December 31st, 2006 at 3:52 pm

    Nevermind. Was because I was trying to access the external address from my internal device. *slaps head*

  53. Greg said on January 9th, 2007 at 10:21 am

    My SFTP does not appear to work after these instructions, I can SSH to the box however SFTP does not apear to be installed or setup. I get the following error

    Looking up host “localhost”
    Connecting to 127.0.0.1 port 22
    Server version: SSH-2.0-OpenSSH_3.8.1p1
    version: SSH-2.0-SSH-Local: Mar 5 2006 23:44:38
    Using SSH protocol version 2
    processing group exchange
    processing key exchange
    Host key fingerprint is:
    ssh-rsa 1024 ca:2f:d0:1a:8f:bf:d6:f7:c6:08:13:1a:21:69:c3:21
    Initialized AES-256 client->server encryption
    Initialized AES-256 server->client encryption
    Keyboard-interactive authentication refused
    Sent password
    Access granted
    Opened channel for session
    Started shell session
    Server sent command exit status 0
    All channels closed. Disconnecting
    Unable to initialize SFTP: 潣汵⁤潮⁴潣湮捥t (sftp not enabled?)
    Can’t establish connection –> localhost:22 @ Tue Jan 09 11:43:51 2007 (122-1)

    Can anyone help?

  54. Chris Tran said on January 11th, 2007 at 3:52 pm

    Hi Thanks for the excellent article. Much appreciated. I’m having a problem with configuring the group and passwd files. When i tried to run the mkgroup and mkpasswd commands i get the message “mkgroup: A domain name is only accepted when `-d’ is given”. Please let me know whatam doing wrong. Thank you in advance

  55. Nicholas Kouvatsos said on January 16th, 2007 at 5:39 pm

    FYI everyone…Windows 2003 Server is NOT currently supported.

  56. Brian Dao said on January 23rd, 2007 at 6:34 pm

    I have successfully set it up on W2K3 server and using FileZillar v2.2.26a to connect to it. I set the home directory to D:\FtpUsers\Test. The home directory content shows up fine when I login but I find myself able to navigate out of the home directory and read/write files just about any where… The physical path also showing under Remote Site.

    1. Is there any way to hide the physical path so the user just see “/” as the home directory?

    2. Is there any way to lock the user in home directory?

    Thanks,

    Brian Dao

  57. Anil said on January 23rd, 2007 at 10:35 pm

    i have setup the OpenSSH on windows 2003 server and able to logon. But sft-server subsystem is shoinf error and unable to proced.

  58. RJ45 said on February 5th, 2007 at 1:01 am

    Thank you, I followed the instructions and it’s worked with me

  59. tkc said on February 6th, 2007 at 7:32 pm

    im unable to change the default directory, it defauts to c:/program files/openssh.

    cygwin doesnt work for some reason.

  60. ben said on February 12th, 2007 at 10:19 pm

    What a great guide that people are still finding a use for 2 years after it was written. Totally easy to set up for someone with average server admin experience.

  61. Vic said on February 13th, 2007 at 1:45 pm

    So far I finshed reading the readme file and the quick gudie, and I am having some problems getting OpenSSH to work properly:

    1) When I am typing mkgroup -l >> ..\etc\passwd I get this message “A domain name is only accepted when -d is given”
    Can anyone tell me how do I solve this problem? I typed mkgroup -l and it was able to retreive the local groups, but I cannot find the group file

    2) Also is there a way that I can only specify just “one” group to be added to the group file instead of having “all” the local groups being copied to the mkgroup file?

    Any help is greatly appreicated. Thank You

  62. joe said on March 7th, 2007 at 3:16 am

    guys,
    i stuck in the cygwin1.dll, any idea?

  63. Russ said on March 7th, 2007 at 10:31 am

    Worked perfectly! Thanks for info on an easy, free SFTP solution. We need SFTP, not for security, but because that’s the only reliable way for Eclipse to http://FTP… via the Secure ESFTP Plugin.

    Thanks!

  64. Jamal said on March 15th, 2007 at 11:44 pm

    I am running SSH on Windows 2003 Server. Thanks for your instrctions which helped me a lot.

    I would like to block some users only to use SFTP (not SSH). And would like to restrict them to a directory C:\Upload and its sub directories. I would like to block them to view even C:\(even \home, \home\user).

    Thanks in Advance.

  65. Josh said on March 21st, 2007 at 7:48 am

    Thank you for the great tutorial!

    I just created a video tutorial based on this tutorial. Click on this link: Windows SSH, SCP and SFTP Server

  66. Tips and Tutorials - Linux .: Cisco :. VOIP » Windows - SSH, SCP and SFTP Server said on March 22nd, 2007 at 4:32 pm
  67. Pianelli said on April 7th, 2007 at 1:03 pm

    Having trouble to install the SFTP-Server on Windows. Can anybody help me?

  68. Sofort Kredit said on April 10th, 2007 at 10:17 pm

    Hi Pianelli, I will try to assist you, its not that hard!

  69. jaysonf said on April 12th, 2007 at 9:24 pm

    is there a way i can limit a specific users downloads to to a specified number of times?

  70. Ted said on May 12th, 2007 at 4:20 pm

    FYI, I had to uninstall File and Printer Sharing on the client system before it would work for me.

    Go to Control Panel, right click on the connection you are using, and go to Properties. Select the File and Printer Sharing item and click Uninstall.

  71. Floyd Schleyhahn said on May 18th, 2007 at 7:48 am

    I just installed your product. However, I am able to connect to it via FireZilla but nothing happens when I try to upload a file to it. Also, is there a way to modify the welcome banner?

    Thanks

  72. Floyd Schleyhahn said on May 18th, 2007 at 7:49 am

    I should re-phrase what I just submitted–I don’t think I am getting connected:
    Status: Connected with BRES_Intranet:22. Waiting for welcome message…
    Response: SSH-2.0-OpenSSH_3.8.1p1

  73. Terry said on May 18th, 2007 at 1:24 pm

    I’m able to connect using ssh however, I can not change my home directory.

    I’ve changed the reg default location and the password location and it still only takes me to the root of the ssh program.

  74. Ricky said on May 22nd, 2007 at 9:54 pm

    Great job man, figuring out the semantics for all those little details can be time consuming. Thank you!

  75. Kumar said on May 28th, 2007 at 9:26 pm

    Thank you so verymuch. This was really helpful. Excellent narration. It worked on the first try itself.

  76. Beardo said on June 3rd, 2007 at 3:53 am

    Anyone else tried this on vista x64? Thoughts would be appreciated but I’m guessing it’s terminal until a compatible version is released.

    The opensshd service remains ’starting’. It times out with error 1053 - did not respond in a timely manner.

    Event viewer showing:-

    Log Name: Application
    Source: Application Error
    Date: 03/06/2007 11:36:35
    Event ID: 1000
    Task Category: (100)
    Level: Error
    Keywords: Classic
    User: N/A
    Computer: captaincaveman
    Description:
    Faulting application cygrunsrv.exe, version 0.0.0.0, time stamp 0×40826252, faulting module cygwin1.dll, version 1005.10.0.0, time stamp 0×40b3fbf6, exception code 0xc0000005, fault offset 0×00092802, process id 0×139c, application start time 0×01c7a5cb0f25a2df.
    Event Xml:

    1000
    2
    100
    0×80000000000000

    2815
    Application
    captaincaveman

    cygrunsrv.exe
    0.0.0.0
    40826252
    cygwin1.dll
    1005.10.0.0
    40b3fbf6
    c0000005
    00092802
    139c
    01c7a5cb0f25a2df

  77. Daniel said on June 5th, 2007 at 3:45 pm

    I have tried and tried but I can’t get this to work.

    It installs and seems to configure properly.
    I can connect (I get the connection message), but it will not authenticate.
    I then tried another commercial SFTP server on trial and I get the same thing!

    I’ve spent hours and hours on this but I can’t figure out what’s wrong.

    Please help!

  78. Dave said on June 8th, 2007 at 12:06 pm

    Installed and configured Openshh on Windows 2003 sbs server, works well from inside and outside access but with an issue.

    Issues:
    used /cygdrive/E/public on passwd file to point to the users public folders but it does not work. All users login defaults to the c:\program files\openssh\etc folder.

    Any idea on how I could fix the issue?

    Many Thanks!

  79. Dave said on June 8th, 2007 at 12:12 pm

    Nevermind! I fixed it!

    Thank you for a great blog.

    Dave…

  80. Kiki said on June 13th, 2007 at 9:34 am

    Dave,

    How were you able to fix the issue of login defaulting to the “c:\program files\openssh\etc” folder and not being able to change directory from there? I’m having the same issue. Please help…

  81. Debbie said on June 18th, 2007 at 2:52 pm

    Followed intructions, service does not install or start.
    Password file and group file created, no problem.
    I do not see any solutions for my problem in the blog.
    Any ideas?

  82. Blackholesun said on June 20th, 2007 at 11:48 am

    Hi Beardo,

    Were you able to successfully install and run OpenSSH server on Windows Vista? I am facing the same issue, the service simply won’t start. I have tried it on Windows Vista Business and Windows Vista Enterprise Editions (32-bit), but no luck

    I was able to start the service on Vista by starting the service in XP Compatibility mode, but I was not able to connect to it then. Though the services window shows it as started but nothing happens, no connection, no authentication just nothing.

    Please let me know if you have (or someone else) any solution to this issue. I desperately need it to run on Vista since my application is dependent on it.

    Regards

  83. Mac said on July 4th, 2007 at 8:13 am

    Once I log in, it goes to c:\program files\openssh\etc folder. Is there a way that I can force it to be another default directory?

  84. Mac said on July 5th, 2007 at 11:22 am

    Found the answer to my own question. If you have the username as the folder name in your ‘Documents and Settings’ folder, then it will go into that folder. If it can’t find that folder with that username, then it will default to the ‘c:\program files\openssh\etc’ folder.

  85. Will said on July 10th, 2007 at 4:26 pm

    I’m getting an ‘Access Denied’ response when I try to change the Password & Group files. Respectivley, I get the same issue when I try to connect ‘Authentication Failed.’ Someone help.

  86. dipak said on July 12th, 2007 at 4:33 pm

    thank’s ….it was great ..i was able to creat my sftp server but one problem …how to restrict the user to one directory so that he can’t browse the root directory ….please help me …..

  87. Marcel said on July 15th, 2007 at 8:21 am

    I have Problems to install the SFTP-Server on Mac. Can anybody help me?

  88. Tim said on July 16th, 2007 at 1:15 am

    I am not able to change the directory path. I edited the passwd file to /cygdrive/h/web and still getting into the openssh directory when I connect. Any help would be appreciated. Thanks!

  89. Will said on July 16th, 2007 at 11:44 am

    Any ideas on why I get and “Access Denied” response when trying to login or change passwd/Group files?

    ———————————————

    Will said on July 10th, 2007 at 4:26 pm
    I’m getting an ‘Access Denied’ response when I try to change the Password & Group files. Respectivley, I get the same issue when I try to connect ‘Authentication Failed.’ Someone help.

  90. dumdum31 said on July 18th, 2007 at 5:42 pm

    LOL. Just use FileZilla server app. It supports setting up a SFTP Server. ANd its a point-click process. Alternatively, you could use Serv-U FTP server. They are both excellent free FTP - SFTP server apps.

  91. dumdum31 said on July 30th, 2007 at 11:46 am

    dumdum31,

    Don’t know what your definition of “free” is, but Serv-U definitely is not. It’s a commercial program with a 30-day trial demo. Hardly “free.”

  92. Bill Nelson said on July 31st, 2007 at 12:52 pm

    cannot connect from remote pc unless,,,and this is odd,,unless the remote pc is connected by telephone modem to anyone else. I tried from one remote pc, in house, to the server, can’t connect. Dialed a customer’s modem with the remote pc, connected, was able to establish the SFTP connection to the server from the remote. ??

  93. Bill Nelson said on July 31st, 2007 at 1:13 pm

    guess it would help to leave a way to contact me. This is really confusing, but i bet it’s something way too obvious.
    800 404 9641; or bill@healthsourceconsultant.com

  94. CoreyH said on August 1st, 2007 at 5:50 am

    Just wanted to thank you for the instructions. Worked like a charm!

    CoreyH

  95. Jim Ciallella said on August 7th, 2007 at 9:36 am

    I wasn’t able to get the Windows share drive to work by using either the /cygdrive/F syntax or by changing the Windows registry key HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/home to a drive letter path like F:\, as one would think from the Readme.txt

    Instead open the Windows Registry Editor by typing regedit in the Start->Run box.

    Then browse to the key HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/home
    You can now double-click the “native” value and change it to something like \\servername\foldername . This is the same path you(d) enter when creating a Windows share drive. Once you’ve done this be sure to close any existing SFTP or SSH connections and then reconnect and try to visit /home.

    (NOTE: do not type the double-quotes, they are included only for clarification)

    You can also create new alias by adding another key to the Windows registry under \mounts v2\ Right-click on \mounts v2\ and select New->Key. Name the key something you want, like “\sharepath” Highlight the new “\sharepath” key. Right-click on it and select New->Dword. Name it “flags”. Double-click “flags” and enter the value “a”. Right-click on “sharepath” and select New->String. Name this “native”. Double-click the “native” value and enter the path you want, this can be anything like “C:\Somefolder” or “\\somecomputer\somefolder”

  96. Jim Ciallella said on August 7th, 2007 at 11:18 am

    Clarification. Any new registry keys would have to be of the form “/sharepath” (notice the frontslash, not a backslash as I wrote above). Again, the quotes should not be typed.

  97. Chan said on August 9th, 2007 at 11:18 am

    How do I set up locks using ACLs

  98. Matt said on August 14th, 2007 at 10:00 am

    to those who receive this type of message:

    Status: Connected with BRES_Intranet:22. Waiting for welcome message…
    Response: SSH-2.0-OpenSSH_3.8.1p1

    this happens when you only specify the port, not the protocol when making the connection. if you are using filezilla, instead of using a quick connection, you need to create a new connection and indicate the type as SFTP. in Filezilla do the following:

    File
    Site Manager…
    New Site (name it something) then in the Site Details:

    host name = yoursite
    port = 22
    Servertype: SFTP using SSH2
    Logontype: Normal supply the credentials you setup earlier.

    Save and Exit.

    Now on the main screen, click the new site to connect to (icon below File & Edit)

    *profit*

  99. Matt said on August 15th, 2007 at 7:44 am

    can someone help with the proper way to indicate a home folder where the folder name has a space in it?

    example:

    C:\NEW FOLDER\TEST = /cygdrive/c/NEW FOLDER/TEST:

    the above does not work.

  100. Lukas said on August 15th, 2007 at 10:44 am

    Thanks for your instructions.
    It works fine.

    Best regards.
    Lukas

  101. Karl Kani said on August 16th, 2007 at 6:01 am

    Thank you for this useful tutorial!

    Greetz Karl

  102. ck said on August 22nd, 2007 at 8:48 pm

    I am having hard time in starting service on Vistal Ultimate. I get follwing errors.

    ‘Error 1067 : The process terminated unexpectedly’
    and Vista alerts saying
    ‘cygrunsrv.exe’ has stopped working.

    Service is configured to run under ‘Local System’.

    I tried changing service logon user to “Administrator’ still doesn’t work

    I appreciate any help

    Thanks
    CK

  103. Bas said on August 28th, 2007 at 10:22 pm

    Works fine! Thanks!
    The only thing you haven’t mentioned is that at the end user should run “net start opensshd” to start SFTP server.
    Cheers

  104. Larry said on August 29th, 2007 at 10:13 am

    What worries me about this solution is that the Windows version of SSH being used here and the only one available is from 2004! Didn’t openSSH come out with numerous critical patches since then?! Where’s the Windows OpenSSH update?

    I’m going to try the install using copSSH, which is another Windows OpenSSH version that appears to have updates into 2007 and should therefore be more secure. URL is here:
    http://www.itefix.no/phpws/index.php?module=pagemaster&PAGE_user_op=view_page&PAGE_id=12

  105. adam said on August 31st, 2007 at 6:47 am

    i see you can make it just do the ssh shell and not sftp can you do do the reverse! just give user sftp access!

    excellent program so easy to configure :)

  106. Benji said on September 6th, 2007 at 3:24 pm

    I was having authentication issues and I finally figured it out. My account name had a space in it I.E. John Smith. To properly ad the user to the passwd file I had to do:

    mkpasswd -l -u “Benji Park” >> ..\etc\passwd

    Then in winscp set username to Benji Park (no quotes) and I logged in fine.

    When I tried to add the user without the quotes I would get the “A domain name is only accepted when `-d’ is given” error. To know what the name of your account is you can find it by right clicking on “My Computer” and selecting “manage”. Navigate to “Local Users and Groups” then “Users”. You will see “name” and “full name” for accounts. For openssh “name” is the only thing to pay attention to.

    Hope this helps someone.

  107. Dimitry said on September 7th, 2007 at 8:41 am

    For those of you that are interested in locking down the shell and only allowing scp and sftp, there is an easy solution. Just disable all access to cmd.exe, for the account that is being used to log into the ssh/sftp/scp. This file is in the system32 folder.

  108. Brian said on November 1st, 2007 at 8:33 pm

    Worked well for me. If you are forwarding a port through your router, make sure that you are forwarding from “all” ports to port 22 using TCP. You can’t go from 22 to 22 only. Not sure why this is the case.

  109. Jovin Joy said on November 6th, 2007 at 11:26 am

    I have a peculiar problem I am able to use ssh to connect to my computer even from remote hosts but when i use sftp the authentication completes(keyboard interactive ..apparently)…but the connection closes as soon as the authentication is complete…Here is the verbose output of the command sftp –v “userid”@localhost

    debug1: Authentications that can continue: publickey,password,keyboard-interactive
    debug1: Next authentication method: publickey
    debug1: Trying private key: /home/userid/.ssh/id_rsa
    debug1: Trying private key: /home/userid/.ssh/id_dsa
    debug2: we did not send a packet, disable method
    debug1: Next authentication method: keyboard-interactive
    debug2: userauth_kbdint
    debug2: we sent a keyboard-interactive packet, wait for reply
    debug1: Authentications that can continue: publickey,password,keyboard-interactive
    debug2: we did not send a packet, disable method
    debug1: Next authentication method: password
    userid@localhost’s password:
    debug2: we sent a password packet, wait for reply
    debug1: Authentication succeeded (password).
    debug2: fd 4 setting O_NONBLOCK
    debug2: fd 5 setting O_NONBLOCK
    debug1: channel 0: new [client-session]
    debug2: channel 0: send open
    debug1: Entering interactive session.
    debug2: callback start
    debug2: ssh_session2_setup: id 0
    debug1: Sending subsystem: sftp
    debug2: channel 0: request subsystem
    debug2: callback done
    debug2: channel 0: open confirm rwindow 0 rmax 32768
    debug2: channel 0: rcvd adjust 131072
    debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
    debug2: channel 0: rcvd eof
    debug2: channel 0: output open -> drain
    debug2: channel 0: obuf empty
    debug2: channel 0: close_write
    debug2: channel 0: output drain -> closed
    debug2: channel 0: rcvd close
    debug2: channel 0: close_read
    debug2: channel 0: input open -> closed
    debug2: channel 0: almost dead
    debug2: channel 0: gc: notify user
    debug2: channel 0: gc: user detached
    debug2: channel 0: send close
    debug2: channel 0: is dead
    debug2: channel 0: garbage collecting
    debug1: channel 0: free: client-session, nchannels 1
    debug2: fd 0 is not O_NONBLOCK
    debug2: fd 1 is not O_NONBLOCK
    debug1: Transferred: stdin 0, stdout 0, stderr 0 bytes in 0.2 seconds
    debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0
    debug1: Exit status 0
    Connection closed

    when I connect using WinSCP I get the following message..
    Cannot initialize SFTP protocol. Is the host running a SFTP server?
    sshd is running as a process in the background

  110. Ahmed Waqas said on November 6th, 2007 at 12:48 pm

    Hi,

    very good doc

  111. Dwayne said on November 8th, 2007 at 5:44 am

    I’m having OpenSSH problems. With putty, I’m attempting to log in with the username that I use for my PC and get a return of “Access Denied”.

    How do I ensure I have my passwd setup correctly. When I attempted to properly add my username to the passwd file in cmd, it returned that the user name could not be found.

    Can anyone assist?

  112. Ben said on November 25th, 2007 at 10:55 pm

    This was almost great. Almost.

    My OpenSSH installation would not work on WinXP Pro. Turns out the issue was a space in the installation path (E:\Program Files). This documentation covers nothing about starting the service (or troubleshooting, not even a link to FAQ for troubleshooting).

    Once I installed to a path with no space in it (took me 5 hours to figure out, due to terrible error reporting and lack of online docs that I could find), things worked great.

    So… thanks! … almost.

    Ben
    http://www.dodtracker.com/

  113. ttest said on November 26th, 2007 at 12:55 am

    follow the video instruction above. user account is the windows account you have or will need to setup. before using sftp client program, turn on the OpenSSH service by starting it. account/username is the username you created using the command earlier. Password is the windows user account password under that username.

    if you were able to connect locally and not remotely, it could be the firewall. go to Network Connections –> local area connection –> Advanced –> Setting –> Exception tab –> Add port 22.

  114. Rich W said on December 7th, 2007 at 3:32 pm

    For a platform independent FTP, FTP/S, SFTP, HTTP/S, WebDAV server you might look at http://www.jscape.com/secureftpserver/

    has some nice features with a free community edition.

  115. Flemming said on December 19th, 2007 at 4:27 pm

    If you just needs to transfer a few files - I find CoreFTP mini sftp server extremely usefull and it is free and was up and running with the first user logged on in less than 2 minutes :)
    http://www.coreftp.com/server/

  116. Steve said on December 21st, 2007 at 2:15 am

    We wan’t to run a SFTP server on a windows 2003 Enterprise Edition in CLUSTER ! Does anyone know which application can be installed in a cluster environment to offer SFTP? Thanks. Steve

  117. Dan D. said on January 1st, 2008 at 2:01 pm

    Thank you kindly for this wonderful step-by-step howto. I second the earlier recommendation that you add a step which reminds users to start the service after following your instructions as it is not running by default.

  118. Anita said on January 29th, 2008 at 11:07 pm

    Anybody has luck in installing/binding SFTP in clusterd environment. I have one virtual server cluster using two machines

  119. Samer B. said on January 30th, 2008 at 3:39 pm

    Steve & Anita, it works on clusters, and no luck involved here. Using the manual above, simply note the following:

    - since you can’t use a domain account, create the same local account on each cluster node with the same password, and use it to create each passwd file.

    Now, assuming the sftp directory is on a shared storage, for ex S:\SharedFtp, also note:

    - add OpenSSHd service as a Generic Service resource in the cluster configuration in the same resource group as the shared storage disk and the virtual server IP, with proper dependancy.
    - assign proper NTFS permissions to the home directory S:\SharedFtp in EACH node for the local account created on that particular node. Also you should probably deny access to all other drives and folders outside this directory, in each node, for the ftp account created.

    If you require clarification, just ask.

  120. Daniel said on February 6th, 2008 at 10:13 am

    Make sure you TURN OFF YOUR IIS FTP!

  121. Thomas said on February 6th, 2008 at 8:40 pm

    This might be an easier solution for some of you: http://www.freesshd.com/

  122. Michael said on February 25th, 2008 at 5:27 pm

    CopSSH was even easier to install and supports Vista… Customization options from this article carry over as well, e.g. changing the home directory in the passwd file.

  123. Steve Rhoads said on March 10th, 2008 at 1:18 pm

    How do I run a transaction using a script file? I have tried the following with several variations to no avail.

    sftp -b ScriptFile hostname

    contents of ScriptFile:
    user username_password
    ls
    quit

  124. ShellDude said on May 8th, 2008 at 11:51 am

    If you can read, you can successfully install Openssh with this guide. Sickenly simple install with vast possibilities from an administration perspective.

  125. ShellDude said on May 8th, 2008 at 11:52 am

    Steve,

    Try using a shellexec tool like plink (it’s part of the putty suite)

Leave a Reply