IIS7:通过脚本来配置ftp站点
Appcmd.exe是IIS7提供的一个管理站点的命令行工具,同时支持Ftp和Http的站点,功能还算强大,具体使用方法参考微软网站。
需求
我这里的例子主要配置一个Ftp站点,并且允许CcUser这个用户对其目录具备读和写的权限:
代码
@echo off
set cc_inbox_dir=c:\CC_Inbox
set cc_outbox_dir=c:\CC_Outbox
set 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:apphost
要点
- appcmd.exe默认没有添加到Path里,需要指定完整的路径。
- 如果64机器上应该使用64位的版本,32位的版本在Wow64目录下
- 如果需要IP Address设置成“All Unassigned”,在bindings的时候使用“*”,而不要使用ip地址或机器名
- “/app.name”参数的值应该以“/”结尾,比如应该用“CC_Inbox/”而不是“CC_Inbox”
- Authentication的设置在添加ftp站点的时候没法设置,但是可以通过修改ftp站点的属性来完成
- Authorization(比如文件的访问权限)不在ftp站点的属性中,而是system级别的属性,修改完最后记得提交 “/commit:apphost”
参考资料
- IIS官方文档:Getting Started with AppCmd.exe
- IIS官方文档:http://www.iis.net/configreference/system.ftpserver/security/authorization
- 通过修改配置文件(ApplicationHost.config)的方式创建ftp站点
IIS7:通过脚本来配置ftp站点的更多相关文章
- 如何在Windows Server 2003中配置FTP站点服务
前面写过一篇文章<怎样给你的网站注册一个好域名?> ,讲到“玉米”,笔者有很深的情节,也希望与大家交流“米事”,可以站内私信我或者直接回复文章. 有了好域名只是做网站的开始.我们还要买主机 ...
- Windows2008 IIS配置FTP站点
视频教程:http://vodcdn.video.taobao.com/player/ugc/tb_ugc_pieces_core_player_loader.swf?version=1.0.2015 ...
- Windows10+IIS7.5上如何配置PHP站点
最近我一直在写PHP,但是我很喜欢微软的开发环境和Windows的硬件环境,我就想在IIS上配置一下PHP站点,这样用起来也比较方便,在经过各位前辈的文章学习后,自己整理了一个比较简单的图片为主的教程 ...
- win7配置ftp服务
1.首先开启ftp服务 2.配置ftp站点 3.让ftp服务器通过防火墙 4.编辑ftp访问权限,使用户能通过账号密码访问ftp,当然,在此之前,需要创建一个新的用户 到此,就可以远程访问ftp了
- Windows 2008 IIS7.5中创建独立账号的FTP站点图文教程
Windows 2008上的IIS7.5,FTP功能已经非常强大了,完全不下于Serv-U这样的第三方软件.本文小编就介绍在IIS7.5上配置独立账号的FTP站点. 1.创建Windows账号 右击点 ...
- IIS7.5 在已有的WEB网站上配置FTP发布
IIS7.5 有了很多新特性,例如FashCGI,Rewrite 模块的内置,简易的FTP发布等等,但是即使是微软,也没有详细的文档,本文详细的介绍了如何在现有的WEB网站上建立FTP发布. IIS ...
- FTP 站点及配置
新建FTP站点根据导航步骤一步步来即可. windows server 2008 中ftp的部署以及防火墙的配置 部署环境:Windows Server Enterprise 2008 R2 64b ...
- Windows Server 2008 R2 IIS7.5配置FTP图文教程
本文为大家分享了IIS 配置FTP 网站的具体过程,供大家参考,具体内容如下 说明:服务器环境是Windows Server 2008 R2,IIS7.5. 1. 在 服务器管理器的Web服务器(II ...
- 阿里云服务器 FTP配置图文教程和添加两个FTP站点
1.添加FTP账号和密码. A. 选择“服务管理器”->“配置”->“本地用户和组”->“用户”:在空白处右键选择“新用户”: B. 输入用户名,全名和描述可以不填写:输入两遍密码: ...
随机推荐
- 2016集训测试赛(二十一)Problem C: 虫子
题目大意 给你一棵树, 每个点有一个点权. 有两种操作: link / cut 修改某个点的点权 每次操作后, 你要输出以下答案: 在整棵树中任意选两个点, 这两个点的LCA的期望权值. Soluti ...
- 转:java多线程CountDownLatch及线程池ThreadPoolExecutor/ExecutorService使用示例
java多线程CountDownLatch及线程池ThreadPoolExecutor/ExecutorService使用示例 1.CountDownLatch:一个同步工具类,它允许一个或多个线程一 ...
- c# datetime是一年中的第几周
public static int WeekOfYear(DateTime dt, CultureInfo ci) { return ci.Calendar.GetWeekOfYear(dt, ci. ...
- 缺少 Google API 秘钥,因此 Chromium 的部分功能将无法使用
获取密钥(ID)教程: https://www.chromium.org/developers/how-tos/api-keys 获取密钥(ID)地址: https://cloud.google.co ...
- python GIL
https://www.cnblogs.com/MnCu8261/p/6357633.html 全局解释器锁,同一时间只有一个线程获得GIL,
- selenium firefox46.0.1设置禁用图片
firefox_profile = webdriver.FirefoxProfile()firefox_profile.set_preference('permissions.default.ima ...
- 常用jar包之commons-digester使用
常用jar包之commons-digester使用 学习了:https://blog.csdn.net/terryzero/article/details/4332257 注意了, digester. ...
- 过滤器Filter_03_多个Filter的执行顺序
过滤器Filter_03_多个Filter的执行顺序 学习了:https://www.cnblogs.com/HigginCui/p/5772514.html 按照在web.xml中的顺序进行filt ...
- 115. distinct subsequence leetcode python
Given a string S and a string T, count the number of distinct subsequences of T in S. A subsequence ...
- JSBridge深度剖析
概述 做过混合开发的人都知道Ionic和PhoneGap之类的框架,这些框架在web基础上包装一层Native.然后通过Bridge技术的js调用本地的库. 在讲JSBridge技术之前.我们来看一下 ...