pkgmgr /iu:IIS-FTPServer;IIS-FTPSvc;IIS-FTPExtensibility;
cd %windir%\system32\inetsrv set ftproot=%systemdrive%\inetpub\ftproot set ftpsite=MyFtp if not exist "%ftproot%" (mkdir "%ftproot%") appcmd add site /name:%ftpsite% /bindings:ftp://*:21 /physicalpath:"%ftproot%" appcmd set config -section:system.applicationHost/sites /[name='%ftpsite%'].ftpServer.security.authentication.AnonimouseAuthentication.enabled:true appcmd set config -section:system.applicationHost/sites /[name='%ftpsite%'].ftpServer.security.ssl.controlChannelPolicy:"SslAllow" appcmd set config -section:system.applicationHost/sites /[name='%ftpsite%'].ftpServer.security.ssl.dataChannelPolicy:"SslAllow" appcmd set config -section:system.applicationHost/sites /[name='%ftpsite%'].ftpServer.directoryBrowse.showFlags:DisplayVirtualDirectories appcmd set config -section:system.applicationHost/sites /[name='%ftpsite%'].ftpServer.userIsolation.mode:StartInUsersDirectory appcmd set config %ftpsite% /section:system.ftpserver/security/authorization /+[accessType='Allow',permissions='Read',roles='',users='*'] /commit:apphost
inetpub\ftproot
on the system disk, and link it to the root folder of our site “MyFtp”. We also configured our site to use anonymous authentication. And they put SSL into allow mode (by default it requires). The last line we distributed read permissions to all users. Now we have to add virtual folders to our site and we can use it, and the showFlags: DisplayVirtualDirectories parameter will allow us to see not only the root directory, but also virtual directories too. appcmd add vdir /app.name:"%ftpsite%/" /path:/path1 /physicalPath:D:\path1 appcmd add vdir /app.name:"%ftpsite%/" /path:/path2 /physicalPath:\\MEDIASERVER\path2
c:\Users\User>ftp server Connected to SERVER.domain.corp. 220 Microsoft FTP Service User (SERVER.domain.corp:(none)): anonymous 331 Anonymous access allowed, send identity (e-mail name) as password. Password: 230-User logged in. Win32 error: The operation completed successfully. Error details: File system returned an error. 230 End ftp> dir 200 EPRT command successful. 125 Data connection already open; Transfer starting. 06-01-12 04:33PM <DIR> path1 06-01-12 04:33PM <DIR> path2 226 Transfer complete. ftp: 93 bytes received in 0,00Seconds 93000,00Kbytes/sec. ftp>
Add-WindowsFeature Web-Ftp-Server,Web-Ftp-Service,Web-Ftp-Ext
$ftproot="$env:systemdrive\inetpub\ftproot" $ftpsite="MyFtp" if (-not (test-path $ftproot)){ new-item -path $ftproot -type directory } new-item -path IIS:/sites/$ftpsite -type site -bindings @{protocol='ftp';bindingInformation=':21:'} -physicalpath:$ftproot
new-item -path IIS:/sites/$ftpsite/path1 -type virtualdirectory -physicalpath d:\share
Source: https://habr.com/ru/post/145598/
All Articles