{"id":963,"date":"2012-05-02T05:09:00","date_gmt":"2012-05-02T10:09:00","guid":{"rendered":"http:\/\/swildow.darktech.org\/wp\/?p=963"},"modified":"2012-05-02T05:09:00","modified_gmt":"2012-05-02T10:09:00","slug":"setting-up-a-sftp-server-on-windows","status":"publish","type":"post","link":"http:\/\/www.wildow.com\/blog\/?p=963","title":{"rendered":"Setting up a SFTP Server on Windows"},"content":{"rendered":"<h1>Setting up a SFTP Server on Windows<\/h1>\n<p>by Tom<\/p>\n<p><a href=\"http:\/\/www.digitalmediaminute.com\/article\/1487\/setting-up-a-sftp-server-on-windows\" target=\"_blank\">http:\/\/www.digitalmediaminute.com\/article\/1487\/setting-up-a-sftp-server-on-windows <\/a><\/p>\n<p>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.<\/p>\n<p>This tutorial will help you turn your Windows based system into a SecureFTP server.<\/p>\n<p><!--more--><\/p>\n<h3>Background<\/h3>\n<div>\n<ins><ins id=\"aswift_1_anchor\"><\/ins><\/ins><\/div>\n<p>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.<\/p>\n<p>You may have noticed that many <a href=\"http:\/\/www.webhostingsearch.com\/\">webhosts<\/a> 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.<\/p>\n<p>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).<\/p>\n<h3>Installing SSH on Windows<\/h3>\n<div>\n<ins><ins id=\"aswift_2_anchor\"><\/ins><\/ins><\/div>\n<p>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 <a href=\"http:\/\/sshwindows.sourceforge.net\/\">SSHWindows<\/a>, provides a nice Windows installer that will setup the SSH client and Server on your system.<\/p>\n<p>Your first step will be to <a href=\"http:\/\/sshwindows.sourceforge.net\/download\/\">download the Binary Installer Release<\/a> from SSHWindows. Once downloaded, run the installer and be sure to install both the client and server components.<\/p>\n<h3>Configure the SSH Server<\/h3>\n<p>In this next step, I have summarized the information that is included with the <strong>readme.txt<\/strong> that is included with SSHWindows (it can be found in <strong>c:\\program files\\openssh\\docs<\/strong>)<\/p>\n<p>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.<\/p>\n<p>Passwd creation is relatively easy and can be done using two programs that are included with SSHWindows \u2013 <strong>mkgroup<\/strong> and <strong>mkpasswd<\/strong>. Both of these programs are located in the <strong>c:\\program files\\openssh\\bin<\/strong> directory.<\/p>\n<p>To begin creating the <strong>group<\/strong> and <strong>passwd<\/strong> files, open a command prompt window and navigate to the <strong>c:\\program files\\openssh<\/strong> directory.<\/p>\n<p><strong>You must first create a group file<\/strong>. To add all local groups on your computer to the group file, type the command as shown below:<\/p>\n<p><strong>mkgroup -l &gt;&gt; ..\\etc\\group<\/strong><\/p>\n<p>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 <strong>passwd<\/strong> file type the command shown below:<\/p>\n<p><strong>mkpasswd -l -u username &gt;&gt; ..\\etc\\passwd<\/strong><\/p>\n<p><strong>NOTE<\/strong>: the <strong>username<\/strong> specified above must be an existing windows login account.<\/p>\n<h3>Creating Home Directories for you Users<\/h3>\n<p>In the passwd file, you will notice that the user\u2019s home directory is set as <strong>\/home\/username<\/strong>, 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 <strong>c:\\documents and settings<\/strong>.<\/p>\n<p>If you want to change this location you will need to edit the <strong>passwd<\/strong> 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 (<strong>\/home\/username<\/strong>) can be replaced with any other directory to act as that user\u2019s home directory. It\u2019s 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.<\/p>\n<p>To access any folder on any drive letter, add <strong>\/cygdrive\/DRIVELETTER\/<\/strong> at the beginning of the folder path. As an example, to access the <strong>winnt\\system32<\/strong> directory on the *c:* drive you would use the path:<\/p>\n<p>*\/cygdrive\/c\/winnt\/system32*<\/p>\n<h3>Connecting to your SFTP Server<\/h3>\n<p>To connect to your new SFTP server, you will need to download an FTP client that supports SFTP. I use <a href=\"http:\/\/filezilla.sourceforge.net\/\">Filezilla<\/a> which is a nice free FTP and SFTP client. You might also try <a href=\"http:\/\/winscp.net\/eng\/index.php\">WinSCP<\/a> which is another free SFTP client. It is important that the server you wanted to connect to is running SSH.<\/p>\n<p>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 <strong>passwd<\/strong> 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.<\/p>\n<h3>Security<\/h3>\n<p>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.<\/p>\n<h3>Summary<\/h3>\n<p>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! Try this link for info on a <a href=\"http:\/\/www.digitalmediaminute.com\/article\/1191\/free-windows-mail-server\">free mail server<\/a> on Windows.<\/p>\n<p>I\u2019m aware that a certain percentage of people who get to this page don\u2019t find the info they need. I don\u2019t consider Digital Media Minute an overly commercial site, but I\u2019ve decided to include a link to a product that will help some of those people.<\/p>\n<p>ADDITIONAL READING:<br \/>\n1. <a href=\"http:\/\/www.linuxhowtos.org\/System\/shellcommands.htm\">Common SSH Commands<\/a><br \/>\n2. <a href=\"http:\/\/www.openssh.org\/\">Open SSH<\/a><\/p>\n<p>If you are interested in setting up a secure web server and\/or self-hosting, including installing and configuring either IIS, Apache or PWS, router configuration. etc., <a href=\"http:\/\/c1393--7zongsi2e3g7g-4rpet.hop.clickbank.net\/\" target=\"_top\">Click Here.<\/a>\u00a0 (Updated: March 02 2012)<\/p>\n<div>If you found this helpful or interesting, please share it!<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Setting up a SFTP Server on Windows by Tom http:\/\/www.digitalmediaminute.com\/article\/1487\/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 &#8230; <a class=\"more-link\" href=\"http:\/\/www.wildow.com\/blog\/?p=963\">Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/www.wildow.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/963"}],"collection":[{"href":"http:\/\/www.wildow.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.wildow.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.wildow.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.wildow.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=963"}],"version-history":[{"count":2,"href":"http:\/\/www.wildow.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/963\/revisions"}],"predecessor-version":[{"id":965,"href":"http:\/\/www.wildow.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/963\/revisions\/965"}],"wp:attachment":[{"href":"http:\/\/www.wildow.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=963"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.wildow.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=963"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.wildow.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=963"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}