<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Kinath Rupasinghe on Medium]]></title>
        <description><![CDATA[Stories by Kinath Rupasinghe on Medium]]></description>
        <link>https://medium.com/@kinathru?source=rss-1cffacf95c22------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*3n7x8zcXX8-6OBUG</url>
            <title>Stories by Kinath Rupasinghe on Medium</title>
            <link>https://medium.com/@kinathru?source=rss-1cffacf95c22------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 10:32:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kinathru/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to Set Up an SFTP Server in Windows Server 2022]]></title>
            <link>https://medium.com/@kinathru/how-to-set-up-an-sftp-server-in-windows-server-2022-c624f4cda7de?source=rss-1cffacf95c22------2</link>
            <guid isPermaLink="false">https://medium.com/p/c624f4cda7de</guid>
            <category><![CDATA[sftp]]></category>
            <category><![CDATA[ssh]]></category>
            <category><![CDATA[file-server]]></category>
            <category><![CDATA[windows-server]]></category>
            <category><![CDATA[openssh-server]]></category>
            <dc:creator><![CDATA[Kinath Rupasinghe]]></dc:creator>
            <pubDate>Thu, 17 Oct 2024 00:59:45 GMT</pubDate>
            <atom:updated>2024-10-17T00:59:45.019Z</atom:updated>
            <content:encoded><![CDATA[<p>I wanted to set up a secure file server in an on premise windows server environment. When exploring the out of the box options, I came across setting up an FTP server with IIS. Here the issue is that it does not support SFTP. Instead with IIS you can set up an FTPS (FTP over SSL) server.</p><p>When looking for options to set up an SFTP server, I came across the option in enabling OpenSSH server capability in Windows Server. But in order to get this set up correctly I had to go through some troubleshooting steps. So I’m sharing the steps I followed to get SFTP server set up successfully in Windows Server 2022.</p><h3>Install Open SSH Server</h3><p>Execute the following command to check if the OpenSSH capabilities are available in your server</p><pre>Get-WindowsCapability -Online | ? Name -like &#39;OpenSSH*&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*N3yhpfmm8_mIzwcYeRJB8A.png" /><figcaption>Check if Open SSH Server is installed</figcaption></figure><p>As indicated above, OpenSSH Server capability is not present.</p><p>Execute the following command to install Open SSH Server</p><pre>Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0</pre><p>When you execute the above command, you might result in an error like below indicating <em>Add-WindowsCapability failed. Error code = 0x800f0954</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/743/1*SPWgXuJikaR-o-7JTRx9yQ.png" /><figcaption>Add-WindowsCapability failed. Error code = 0x800f0954</figcaption></figure><h3>Troubleshoot Add-WindowsCapability failed. Error code = 0x800f0954</h3><p>In order to troubleshoot the above error, we need to use the <strong>Group Policy Editor</strong> (Local Group Policy Editor) in Windows by executing <strong><em>gpedit.msc </em></strong>command in a Run Window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/399/1*6DRRTPNublQycLrCIabtRA.png" /><figcaption>gpedit.msc command in Run Window</figcaption></figure><p>From the Local Group Policy Editor window, navigate to <strong>Computer Configuration → Administrative Templates → System</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e1QtsZW5JrNU0ai-66_YEQ.png" /><figcaption>Local Group Policy Editor Window</figcaption></figure><p>Double click on <strong><em>Specify Settings for optional component installation and component repair</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jj-PYljZeRFdL1V49V2zGQ.png" /><figcaption><em>Specify Settings for optional component installation and component repair</em></figcaption></figure><p><em>Specify Settings for optional component installation and component repair</em> window looks like below and it’s disabled by default.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*M2q2U6Mv4G1P2emvp5fZHQ.png" /><figcaption><em>Specify Settings for optional component installation and component repair</em></figcaption></figure><p>Enable this setting and select ‘Download repair content and optional features directly from WSUS’</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/689/1*U58ZFVVNxG90STDNcHZ0qg.png" /><figcaption><em>Enable Settings for optional component installation and component repair</em></figcaption></figure><p>Apply settings and click OK</p><p>Navigate back to PowerShell window in administrator mode and execute the following command</p><pre>gpupdate /force</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/470/1*5x5JnY7NNNE_BHaiGvIyow.png" /><figcaption>gpupdate /force</figcaption></figure><p>Execute the following command to install Open SSH Server and now the OpenSSH server should be installed successfully.</p><pre>Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0</pre><p>After OpenSSH Server is installed successfully, make sure to revert back the settings for ‘Specify settings for optional component installation and component repair’</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qGqIszSBDrWKCCJ8An8hrQ.png" /><figcaption><em>Disable Settings for optional component installation and component repair</em></figcaption></figure><h3>Configure OpenSSH Service to Set Up SFTP Server</h3><p>Once OpenSSH Server is installed successfully, we need to configure the OpenSSH services and set up SFTP root directory.</p><p>From Windows services, make the startup type ‘Automatic’ for the following 2 services</p><ul><li>Open SSH Server</li><li>OpenSSH Authentication Agent</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/1*Dpg9ITVXNyvgX75mnxIV_g.png" /><figcaption>OpenSSH services before configuration</figcaption></figure><p>Double click on <strong><em>Open SSH Authentication Agent</em></strong> service and set the startup type to Automatic and Start service</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/409/1*rn7u3q141wgTToa7kXKpoQ.png" /><figcaption><em>Open SSH Authentication Agent Service</em></figcaption></figure><p>Similarly double click on OpenSSH Server and set the startup type to Automatic and Start service</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/1*wHstC8Hj4ENd1mUV-5jVtw.png" /><figcaption><em>Open SSH Server Service</em></figcaption></figure><p>Once both services are set to start up type Automatic and services are started, the services should look like below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*LiHOJAHBn7GE_W_QZGPUZg.png" /><figcaption>OpenSSH services startup type set to Automatic</figcaption></figure><p>Next the SFTP root directory needs to be updated from sshd_config.For this, we need to edit <strong><em>C:\ProgramData\ssh\sshd_config</em></strong> file and update <strong><em>ChrootDirectory</em></strong> key as indicated below. Here I have set the value to ‘F:\SFTP-Dev’</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/795/1*iLYtplx0I3JN9QxuClm8mQ.png" /><figcaption>Set up SFTP root directory</figcaption></figure><p>Now restart the OpenSSH Server service</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*02pMF5BtvN3Z-1vnkibJxg.png" /><figcaption>Restart OpenSSH Server</figcaption></figure><p>Now let’s add a local user that we could use to connect to this SFTP server. Navigate to <strong><em>Server Manager → Tools → Computer Management</em></strong> and navigate to <strong><em>Users</em> </strong>menu item under <strong><em>Local Users and Groups</em>.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/989/1*XfG_Kk0zqgX01rjtnqB0KQ.png" /><figcaption>Local users and groups set up</figcaption></figure><p>Create a new user</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/385/1*modVulmUEfUA_AY933jx3w.png" /><figcaption>Create new user</figcaption></figure><p>Now you should be able to connect to your SFTP server using a SFTP client like FileZilla using the newly created user.</p><p>Alternatively, you can connect to the SFTP server using command line as below.</p><pre>ssh dev-sftp-user@&lt;your_host_name_or_ip&gt;</pre><p>Congratulations! You have successfully set up your SFTP server and connected to it.</p><h3>Troubleshoot Add-WindowsCapability failed. Error code = 0x80072efd</h3><p>When installing OpenSSH Server if you come across this error, you would need to check the firewall rules or proxies blocking the OpenSSH Server download. Following is a screen capture from the Microsoft documentation for this error code and more details could be found <a href="https://learn.microsoft.com/en-us/troubleshoot/windows-client/installing-updates-features-roles/common-windows-update-errors#0x80072efd-or-0x80072efeor-0x80d02002https://learn.microsoft.com/en-us/troubleshoot/windows-client/installing-updates-features-roles/common-windows-update-errors#0x80072efd-or-0x80072efeor-0x80d02002">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*FYPgAoxA1btbeFiPiyvFog.png" /><figcaption>0x80072efd Error Code</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c624f4cda7de" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>