Windows OS Hub
  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu

 Windows OS Hub / Windows Server 2012 R2 / Configuring an FTP Server with User Isolation on Windows Server 2016 / 2012 R2

May 10, 2023 Windows Server 2012 R2Windows Server 2016

Configuring an FTP Server with User Isolation on Windows Server 2016 / 2012 R2

The FTP protocol is one of the oldest protocols (it is more than 40 years old), but it is still widely used where a simple file transfer protocol is required. It is possible to install an FTP server on any version of Microsoft operation system. Last deep modernization of the ftp service was made in Windows 7 / Server 2008 R2 (actually the service code has almost been written from scratch). The security of the service has significantly improved and a number of new features have appeared. In particular, FTP server on Windows allows you to configure FTP user isolation. It allows to restrict access of many users to their own folders on a single FTP server.

Due to the isolation, users can work only with their folders and can’t go up in the FTP directory tree (the user’s top ftp level directory is displayed as the root of the FTP server). Thus, the access to the data of other users on the FTP server can be prevented. FTP user isolation is widely used by ISP/hosting providers when it is necessary to provide individual access to a single file storage for different users.

Like in previous Windows versions, the FTP service in Windows Server 2016 / 2012 R2 (do not confuse it with sFTP and TFTP) is based and deeply integrated into the IIS service and has a single administrative management interface.

In this article we’ll show how to install an IIS-based FTP server on Windows Server 2016/2012 R2 and configure the FTP user isolation (this manual also applies to Windows 10 and 8.1).

Contents:
  • How to Install the FTP Server Role on Windows Server 2016/ 2012 R2?
  • Creating an FTP Site, Managing FTP User Permissions
  • How to Configure FTP User Isolation on Windows Server 2016/2012 R2?
  • Configuring Windows Firewall Rules to Access the FTP Server
  • Testing an FTP Server Connection from Windows

How to Install the FTP Server Role on Windows Server 2016/ 2012 R2?

You can install the FTP service using the Server Manager console by checking the option FTP Service and FTP Extensibility in the section Web Server (IIS) -> FTP Server.

Install ftp server on Windows Server 2012 r2

Also you can install the FTP server role with a single PowerShell command:
Install-WindowsFeature Web-FTP-Server
Install-WindowsFeature Web-FTP-Server

To install the FTP server management console, run the following command:

Install-WindowsFeature -Name "Web-Mgmt-Console"

Creating an FTP Site, Managing FTP User Permissions

Start the Server Manager and open the IIS management console (Internet Information Service Manager).

IIS management console

Create a new FTP site (Sites -> Add FTP Site).

Create ftp site

The name of the FTP site: MyTestSite

The root directory of the FTP site: C:\inetpub\ftproot

ftp site name and path

To protect the FTP data transmitted over the network, it is possible to configure FTPS/SSL for FTP (in this case, all the data and passwords/accounts sent by ftp users during session will be encrypted), but in our demonstration this is not necessary. All other settings are left default.

You can manage your FTP site using the PowerShell module WebAdministration. For example, to create a new FTP site, just run the commands:

Import-Module WebAdministration
# Set the FTP site name
$FTPSiteName = 'CORP_FTP'
#FTP folder
$FTPRoot = 'D:\www\FTPRoot'
#FTP port
$FTPPort = 21
New-WebFtpSite -Name $FTPSiteName -PhysicalPath $FTPRoot -Port $FTPPort

Select a new FTP site and disable the Anonymous Authentication in the FTP Authentication section. Basic Authentication must be enabled.

FTP Authentication

The FTP service on Windows Server 2016/2012 R2 can use two account types: domain or local. Depending on the account type, there are some differences in the structure of FTP directories and user isolation settings. To make it easier to describe, we will use local Windows accounts.

Create some FTP users, suppose, these are ftp_user1, ftp_user2 and ftp_user3. Also create a group ftp_users which includes these users. You can create local users in the Local Users and Groups section of the Computer Management console.

computer managment console

You can also create local users and groups from the command prompt (or using PowerShell). Create a local group:
net localgroup ftp_users /add
net localgroup /add

Create a new local user:
net user ftp_user1 /add *
net user add

Add user to group:
net localgroup ftp_users ftp_user1 /add
add localuser to localgroup

Create the two other users in the same way.

Assign the Read&Write permissions on the directory C:\inetpub\ftproot for the ftp_users group.

ftproot ntfs permissions

Create a directory with the name LocalUser (the name must be the same, it’s important!!!) in the folder C:\inetpub\ftproot. Then make three directories under with the names ftp_user1, ftp_user2, ftp_user3 in the folder C:\inetpub\ftproot\LocalUser.

Note. Depending on the account type, you have to create the following directory structures (under %FtpRoot%\ we mean the root of the FTP site; in our case it is C:\inetpub\ftproot\):

Account TypeSyntax of Home Directory Naming
Anonymous users%FtpRoot%\LocalUser\Public
Local Windows account%FtpRoot%\LocalUser\%UserName%
Domain Windows account%FtpRoot%\%UserDomain%\%UserName%
Special IIS Manager or ASP.NET accounts%FtpRoot%\LocalUser\%UserName%

ftp users home folders

Return to the IIS console and create a new rule (Add AllowRules) in FTP Authorization Rules section of the site. Specify that ftp_users group must have the read and write permisions.

FTP Authorization Rules

How to Configure FTP User Isolation on Windows Server 2016/2012 R2?

Let’s move to configuring FTP user isolation. The isolation of FTP users is configured on the FTP site level, not the entire server. FTP user isolation allows you to organize your ftp-home folder for each user.

Open FTP User Isolation in the settings of the FTP site.

This section contains several settings. The first two of them don’t suggest user isolation:

  1. FTP root directory (an FTP session of a user starts in the root directory of the FTP site);
  2. User name directory (the user starts with physical/virtual directory with the username. If the directory is missing, a session starts in the root FTP directory of the site).

The next three options are different modes of user isolation:

  • User name directory (disable global virtual directories) suggests that the ftp session of a user is isolated in a physical/virtual directory that has the same name as the ftp user. Users see only their own directory (it is their root ftp-directory) and cannot go beyond it (to the upper directory of the FTP tree). Any global virtual directories are ignored;
  • User name physical directory (enable global virtual directories) suggests that the ftp session of a user is isolated in a physical directory that has the same name as the name of the ftp user account. A user cannot go above its directory. However, all created global virtual directories are available to the user;
  • FTP home directory configured in Active Directory – an FTP user is isolated within his home directory specified in the settings of his Active Directory account (FTPRoot and FTPDir properties).
Important. If the global virtual directories are active, all users can access all virtual directories set in the root of the FTP site (if they have the appropriate NTFS permissions).

FTP User Isolation on Windows Server 2012 R2

Select the required isolation mode (I use the second option to isolate ftp users).

It is advisable to restart the Microsoft FTP service (FTPSVC) with any changes to the FTP site settings.

Configuring Windows Firewall Rules to Access the FTP Server

When you install the FTP server role, all necessary rules that are needed for users to access FTP are automatically activated in the Windows Firewall settings.

For FTP to work correctly in passive FTP mode, users need to connect to the RPC port range (1025-65535). In order not to open all these ports on an external firewall, you can limit the range of dynamic TCP ports used for FTP data transmission.

  1. Open the FTP Firewall Support section in FTP site settings and in the Data Channel Port Range field specify the port range that you want to use for FTP connections. For example – 50000-50100;ftp firewall support - set port range on WIndows FTP Server
  2. Save the changes and restart IIS (iisreset);
  3. Open the Windows Control Panel and go to the Control Panel\System and Security\Windows Firewall\Allowed apps;
  4. Make sure that the list of applications that are allowed access through the firewall contains permissions for the FTP Server role.ftp server windows server 2012 r2: firewall rules

Then check that the following rules are enabled in the settings of Windows Firewall with Advanced Security:

  • FTP Server (FTP Traffic-In) – TCP protocol, port 21;
  • FTP Server Passive (FTP Passive Traffic-In) – local port address 1024-65535 (50000-50100 in our case);
  • FTP Server Secure (FTP SSL Traffic-In) –port 990 (when using FTP with SSL);
  • FTP Server (FTP Traffic-Out) – port 20;
  • FTP Server Secure (FTP SSL Traffic-Out) –port 989 (when using FTP with SSL).

windows firewall inbound ftp rules

Accordingly, these ports need to be opened on your router (gateway, firewall) so that external FTP users can connect to your site.

Testing an FTP Server Connection from Windows

You can check the availability of ports on an FTP server using the Test-NetConnection cmdlet:

Test-NetConnection -ComputerName yourftpservername -Port 21

Or using the ftp command:

ftp yourftpservername

Try to connect to your FTP site with any FTP client or directly from File Explorer (specify ftp://yourservername/ in the address bar).

Enter the user name and password.

open ftp site in windows explorer

And now you have access to the home directory with the user’s files (which is the root of the FTP site for the user). As we can see, the user session is isolated and the user sees only his files on the ftp server.

ftp user home folder is isolated

Tip. If you want to use anonymous access (All anonymous Users), any users will be able to connect to your FTP server using the credentials: anonymous or guest as the username and email address as password. If you connect to an FTP site anonymously, the session will be limited to the LocalUser\Public directory (it’s obvious, the Public directory must be created in advance).

You can use FTP logs to view information about user access to the FTP server. The log files are stored by default in the c:\inetpub\logs\logfiles folder in the u_exYYMMDD.log files.

To view the active user connections to your FTP server, you can use the values of the IIS performance counters through PowerShell or the “Current FTP Sessions” section in the IIS console. In this console, you can view the names and the IP address of the FTP user’s and disconnect the ftp-session if necessary.

windows ftp server: current connection list

So, we have looked at how to configure an FTP site with the user isolation based on Windows Server 2016 / 2012 R2. In the isolation mode the users are authenticated on FTP using their local or domain credentials to access their root directory corresponding to the username.

7 comments
0
Facebook Twitter Google + Pinterest
previous post
How to Remove Installed Updates in Windows 10 and Windows Server?
next post
Assign Multiple IP Addresses (Aliases) to a Single NIC

Related Reading

Redirect HTTP to HTTPS in IIS (Windows Server)

September 7, 2023

Add an Additional Domain Controller to an Existing...

September 6, 2023

How to Install an SSL Certificate on IIS...

September 5, 2023

Fix: Remote Desktop Licensing Mode is not Configured

August 24, 2023

Extending a Disk Volume (Partition) in Windows

August 10, 2023

7 comments

MJ Almassud July 31, 2015 - 7:48 pm

Hi,
I am trying to build the same but I am using a secure FTP setup or FTP over SSL so I have to use a secure FTP client to access the site such as CoreFTP or filezilla and for whatever reason I am able to see other users folders even though I am not able to access them.
but I am setting this for a sensitive data transfer so I can’t allow users to see other users folders, because they can be part of different customers.
 
any ideas?

Reply
Max August 14, 2015 - 11:21 am

Try at NTFS level prevent users from displaying content of root folder (List folder permission).

Which user isolation mode do you use?

Reply
Megan September 18, 2015 - 7:43 pm

Hi,
Thank you for your instructions, very helpful! However, I need to have home directory for FTP site on D: drive not C:\inetpub\ftproot. How can I change it in Windows 2012 server?
Thank you,
megan

Reply
Max September 24, 2015 - 11:18 am

Hi
To change the default Home directory on IIS FTP server
1) Right click on the FTP site Manage FTP Site ->Advanced Settings
2) Then change the PhysicalPath> to one you want (by default %systemdrive%\inetpub\ftproot

Reply
john chandler December 23, 2015 - 10:41 am

Hi  
I’m trying to set up an FTP server that uses ActiceDirectory. My problem is that access to folders in FTP is governed by group membership. So, all members of a AD specified group have access to a specified folder. Users can be members of multiple AD groups so they can have access to multiple folders. I’m not sure how to go about this, being new to windows.
Any help is much appreciated.
Thanks
John

Reply
Max December 24, 2015 - 6:53 am

Hi, John

You can for each directory on the FTP server on the NTFS level permissions assign rights for certain   Active Directory groups

Reply
Clark February 21, 2018 - 12:05 am

Thank you. Poor documentation for the isolation portion left me guessing! The LocalUser / Domain directory was what I was missing.

Reply

Leave a Comment Cancel Reply

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMWare
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • How to Connect VPN Before Windows Logon

    November 14, 2023
  • Removing Azure Arc Setup Feature on Windows Server 2022

    November 9, 2023
  • Using WPAD (Web Proxy Auto-Discovery Protocol) on Windows

    November 7, 2023
  • Send Emails with Microsoft Graph API and PowerShell

    November 6, 2023
  • Zabbix: How to Get Data from PowerShell Scripts

    October 27, 2023
  • Tracking Printer Usage with Windows Event Viewer Logs

    October 19, 2023
  • PowerShell: Configure Certificate-Based Authentication for Exchange Online (Azure)

    October 15, 2023
  • Reset Root Password in VMware ESXi

    October 12, 2023
  • How to Query and Change Teams User Presence Status with PowerShell

    October 8, 2023
  • How to Increase Size of Disk Partition in Ubuntu

    October 5, 2023

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • Managing Printers and Drivers with PowerShell in Windows 10 / Server 2016
  • Managing Printers from the Command Prompt in Windows 10 / 8.1
  • Fix: RDP Authentication Error Has Occurred – The Function Requested Is Not Supported
  • How to Reduce Windows.edb Huge File Size?
  • Windows Server Licensing for Virtual Environments
  • How to Restore Active Directory from a Backup?
  • Installing a Free Let’s Encrypt TLS/SSL Certificate on IIS Web Server / RDS
Footer Logo

@2014 - 2023 - Windows OS Hub. All about operating systems for sysadmins


Back To Top