IIS7: configure the ftp site through scripts, iis7ftp
Appcmd.exe is a command line tool for site management provided by IIS7. It supports Ftp and Http sites at the same time. Its functions are powerful. For details, refer to the Microsoft website.
Requirement
My example here mainly configures an Ftp site and allows the CcUser to have the read and write permissions on its directory:
@ Echo offset character = c: \ CC_Inboxset character = c: \ CC_Outboxset appcmd_exe = % systemroot % \ system32 \ inetsrv \ appcmd.exe set ftp_siet_name = CC_Inbox: create cc inbox folder :: rd/S/Q % cc_inbox_dir % if not exist % cc_inbox_dir % (md % cc_inbox_dir %): create cc outbox folder :: rd/S/Q % cc_outbox_dir % if not exist % cc_outbox_dir % (md % cc_outbox_dir %): delete the ftp site and then make a new one. ID of the ftp site will be auto-generated. % appcmd_exe % delete site % ftp_siet_name % appcmd_exe % add site/name: % ftp_siet_name %/bindings: ftp: // *: 21/physicalpath: % cc_inbox_dir % :: add virtual dir for cc outbox. note there is "/'at the end of the app. name % appcmd_exe % add vdir/app. name: "% ftp_siet_name %/"/path:/outbox/physicalpath: % cc_outbox_dir %: config ftp authentication % appcmd_exe % set site % ftp_siet_name %-ftpServer. security. ssl. controlChannelPolicy: SslAllow-ftpServer. security. ssl. dataChannelPolicy: SslAllow-ftpServer. security. authentication. basicAuthentication. enabled: true: config ftp authorization to allow CcUser to read and write % appcmd_exe % set config % ftp_siet_name %-section: system. ftpServer/security/authorization/+ "[accessType = 'allow', users = 'ccuser', permissions = 'read, write']"/commit: apphostKey Points
- Appcmd.exe is not added to Path by default. You must specify the complete Path.
- If the 64-bit version is used on 64 machines, the 32-bit version is in the Wow64 directory.
- If you need to set the IP Address to "All Unassigned", use "*" instead of the IP Address or machine name in bindings.
- The value of the "/app. name" parameter should end with "/", for example, "CC_Inbox/" instead of "CC_Inbox"
- Authentication Settings cannot be set when an ftp site is added. However, you can modify the attributes of an ftp site.
- Authorization (such as file access permissions) is not in the ftp site attribute, but is a system-level Attribute. After modification, remember to submit "/commit: apphost"
References
- IIS official documentation: Getting Started with AppCmd.exe
- IIS official documentation: http://www.iis.net/configreference/system.ftpserver/security/authorization
- Create an ftp site by modifying the configuration file (ApplicationHost. config)
IIS7 add an ftp site
You cannot access IE7 or IE8, but you can access the ftp: // your ip/ip file, for example, ftp: // 127.0.0.1/ip.txt.
In Windows 2008, how does one set FTP in IIS7?
If you want to allow users to upload or download files on the site, you need to set up FTP on the Web server. Whether the site is on the Intranet or the Internet, the principle of uploading and downloading files in the provided location using FTP is the same. You need to put the file in the directory on the FTP server so that you can establish an FTP connection and transfer the file through the FTP client or the FTP Web browser. This article describes how to enable and run the FTP service on a Web server. To set up an FTP site for FTP installation in IIS 7.0, you must first install the FTP service through the role management tool in Windows Server 2008. The procedure is as follows: Install the FTP service on the Windows Client 1. Click "Control Panel" on the "Start" menu ". 2. Click programs and then click enable or disable Windows ". 3. In the "Windows functions" dialog box, expand the "Internet Information Service" node. 4. Expand the "FTP publish service" node and click the "FTP publish service" check box. 5. Click the "FTP console" check box and "FTP server" check box, and then click "OK ". Install the FTP service on a Windows Server 1. on the "Start" menu, click "Administrative Tools", and then click "Server Manager ". 2. In the "role summary" section of the "Server Manager" pane, click "Web Server (IIS )". 3. In the "Web Server (IIS)" section, click "add role service ". 4. Under "role service", select "FTP publish service ". This will install the FTP service and the FTP console. 5. Click "Next", and then click "Install ". Start the FTP service in IIS 7.0, just as if FTP service is not installed on IIS 7.0 by default. After you install FTP service on IIS 7.0, It is not started by default. Therefore, you must start the FTP service after installing it. If the FTP service has been stopped or paused before, you may need to start the service. Start the FTP service on a Windows client. 1. Click "Control Panel" on the "Start" menu ". 2. In control panel, click system and maintenance, and then click Administrative Tools ". 3. Double-click "service", right-click "FTP publish service", and select "start" from the menu ". Start the FTP service on a Windows Server 1. on the "Start" menu, click "Administrative Tools", and then click "Server Manager ". 2. In the "role summary" section of the "Server Manager" pane, click "Web Server (IIS )". 3. In the "Web Server (IIS)" section... the remaining full text>