打开服务器管理器
添加角色和功能
完成安装
打开 IIS 管理器
Win + R → 输入 inetmgr → 回车
创建 FTP 站点
绑定和 SSL 设置
身份验证和授权
# 安装 FTP 功能
Install-WindowsFeature Web-Ftp-Server
# 创建 FTP 目录
New-Item C:\FTPRoot -ItemType Directory
# 创建 FTP 站点
Import-Module WebAdministration
New-WebFtpSite -Name "MyFTP" -PhysicalPath "C:\FTPRoot" -Port 2121
# 设置身份验证
Set-WebConfigurationProperty -Filter "/system.ftpServer/security/authentication/basicAuthentication" -Name enabled -Value True -PSPath IIS:\
# 设置授权规则
Add-WebConfiguration -Filter "/system.ftpServer/security/authorization" -Value @{accessType="Allow";roles="";users="FTPUser";permissions="Read,Write"} -PSPath IIS:\Sites\MyFTP
创建 FTP 专用用户
控制面板 → 管理工具 → 计算机管理
本地用户和组 → 用户 → 新建用户
取消“用户下次登录时须更改密码”
勾选“密码永不过期”
设置文件夹权限
配置防火墙
Windows Defender 防火墙 → 高级设置
入站规则 → 新建规则
选择端口 → 输入 FTP 端口(默认 21)
允许连接 → 完成
被动模式配置
SSL/TLS 加密配置
连接限制
# Windows 命令行
ftp server_ip port
# Linux/Unix
ftp server_ip port
连接失败检查
权限问题
日志查看
C:\inetpub\logs\LogFiles
事件查看器 → Windows 日志 → 应用程序
这样就完成了 Windows Server 2019 中私有 FTP 服务器的搭建。