I’ve been wrestling with OpenSSH for Windows to set up an SFTP server. I’m still ironing out some of the fine detail, but the basic steps are below.
This article covers the initial setup:
- Install the software
- If the FTP user doesn’t already exist in Windows, create it.
- Open a command prompt in the c:\program files\openssh directory (assuming that’s where it’s installed)
- Set up the group file: mkgroup -l >> etc\group
- Set up the passwd file: mkpasswd -l -u username >> etc\passwd
The -l means local user. If it’s a domain user, use -d. Type just mkpasswd for help. - Create the home directory for your user. If following the IIS standard, that would be c:\inetpub\ftproot\username — but it can be anywhere
- Edit the passwd file to put the home directory in. Load it in Notepad or another text editor. As with all the files to do with OpenSSH, passwd is in Unix format, so you may do better to use an editor that knows Unix end-of-line characters. Anyhow, change the second last field to match the home directory. Cygdrive notation needs to be used, eg for the above /cygdrive/c/inetpub/ftproot/username
- For domain users, you’ll have to make sure the Domain Users group is added to the groups file. This can be done by doing a mkgroup > textfile.txt and then extracting the line for Domain Users from the file and adding it manually to the etc\groups file.
Also double-check that the group ID (the third field in the groups file, which is delimited by colons) matches the ID your user(s) in the passwd file (the fourth field). - Start the OpenSSH service (note that when adding additional users, you do not need to restart the service