如何在 Windows Server 虚拟机上配置SFTP 服务器

Azure上创建VM步骤略


点击添加端点,添加FTP端口:

Windows VM SFTP On Azure

点击下一步:

Windows VM SFTP On Azure

添加FTP数据传输端口:

按照上面的步骤添加两个数据端口,我们可以指定任何大于1024的端口号,在此我们添加3000和3001两个端口。


登录虚拟机,搭建FTP服务器:


选中"Web服务器(IIS)"选项

Windows VM SFTP On Azure

点选FTP服务器及其两个子项,如下图:

Windows VM SFTP On Azure

等待安装完成

Windows VM SFTP On Azure

Windows VM SFTP On Azure




双击FTP防火墙,设置端口范围和IP地址,端口范围为我们在创建虚机后添加的数据端口3000-3001,IP地址设置为我们所创建的虚机的VIP地址,在"1. 创建虚拟机"中我们已经查好了,设置完毕后点击"应用"并在弹出的对话框中点击"确定",因为操作系统防火墙是默认开启FTP端口的。

Windows VM SFTP On Azure




添加FTP站点:


Windows VM SFTP On Azure




(请注意:D盘为临时磁盘,不要把数据放在D盘,设置物理路径时,可以把路径设为C盘或添加新的E盘存储数据。)点击下一步,选择允许或需要,如下图:

Windows VM SFTP On Azure



点击下一步,选择基本、所有用户、读取、写入各选项:

Windows VM SFTP On Azure


配置FTP额外的SSL设置

创建一个自签名的SSL书,

Windows VM SFTP On Azure

双击服务器证书,点右侧自签名证书

Windows VM SFTP On Azure

配置SSL选项,双击FTP SSL设置图标打开SSL设置功能页面

Windows VM SFTP On Azure

FTP SSL设置页面显示时,选择自定义选项,然后单击"高级"按钮


Windows VM SFTP On Azure

高级SSL策略对话框显示:

Windows VM SFTP On Azure


为Azure VM配置PIP并查看

Get-AzureVM  -ServiceName  wrfcloud  -Name  FTP | Set-AzurePublicIP -PublicIPName "Web-1-PIP" | Update-AzureVM

=========================

$instance1 = get-azurevm  -ServiceName  wrfcloud  -Name  FTP

$instance1.PublicIPAddress

Windows VM SFTP On Azure


更改FTP防火墙IP地址,上面步骤配置的PIP地址

Windows VM SFTP On Azure

另外可以在防火墙配置页面可以更改以下端口范围:



使用客户端软件首次连接时,出现"证书"对话框

http://dlsw.baidu.com/sw-search-sp/soft/ff/13432/FileZilla_win64_3.14.1.0.1454131478.exe

Windows VM SFTP On Azure

Windows VM SFTP On Azure

测试访问,CMD命令无法访问

Windows VM SFTP On Azure