用程序来自动建立FTP帐号(serv-u的odbc设置)

步骤:
1、建立数据库(可以用任何数据库SQL SERVER,ACCESS均可)
2、建立DNS
3、安装Serv-U
4、建立域
5、完成了。呵呵~!
serv-u build 6.0.0.1版本


        ★ Serv-U FTP Server 6.0.0.1 final


非常好的FTP服务器软件,它设置简单,功能强大,性能稳定。
你现在就可以建立你自己的FTP服务器了。


汉化说明:


1、请先安装原英文软件。
2、退出 FTP Serv-U 应用程序!包括系统栏图标!
3、解压缩后运行汉化包,填入你的安装目录进行汉化。
4、汉化包中另带有企业版的破解补丁:
   Serv-U6001cr.exe,如需要,大家可自行破解,破解前请中
   止系统中的ServUDaemon.exe进程,或中止Serv-U 的服务。
   然后将破解文件复制到 Serv-U 安装目录进行破解。破解后
   为永不过期的“企业版”,如果用了以前的破解版本,可能
   会报告说你盗用了注册码,这时请在“本地服务器--许可”
   中选择“删除密钥”即可。
5、有些原英文版用户汉化后可能会导致设置丢失,这可能是由
   于汉化的资源与英文版不同所致,只能请大家重新设置一下
   了。以前即用汉化版则无此问题。
6、如果以前使用过我的汉化补丁,请将原目录下旧的“汉化说
   明.txt”文件删除后再使用新的汉化补丁。


建立数据库的SQL:


/****** Object:  Database host    Script Date: 2004-12-24 13:16:31 ******/
IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'host')
DROP DATABASE [host]
GO


CREATE DATABASE [host]  ON (NAME = N'Host_Data', FILENAME = N'D:/wwwroot/host/database/host.mdf' , SIZE = 2, FILEGROWTH = 10%) LOG ON (NAME = N'Host_Log', FILENAME = N'D:/wwwroot/host/database/host_log.ldf' , SIZE = 9, FILEGROWTH = 10%)
COLLATE Chinese_PRC_CI_AS
GO


exec sp_dboption N'host', N'autoclose', N'false'
GO


exec sp_dboption N'host', N'bulkcopy', N'false'
GO


exec sp_dboption N'host', N'trunc. log', N'false'
GO


exec sp_dboption N'host', N'torn page detection', N'true'
GO


exec sp_dboption N'host', N'read only', N'false'
GO


exec sp_dboption N'host', N'dbo use', N'false'
GO


exec sp_dboption N'host', N'single', N'false'
GO


exec sp_dboption N'host', N'autoshrink', N'false'
GO


exec sp_dboption N'host', N'ANSI null default', N'false'
GO


exec sp_dboption N'host', N'recursive triggers', N'false'
GO


exec sp_dboption N'host', N'ANSI nulls', N'false'
GO


exec sp_dboption N'host', N'concat null yields null', N'false'
GO


exec sp_dboption N'host', N'cursor close on commit', N'false'
GO


exec sp_dboption N'host', N'default to local cursor', N'false'
GO


exec sp_dboption N'host', N'quoted identifier', N'false'
GO


exec sp_dboption N'host', N'ANSI warnings', N'false'
GO


exec sp_dboption N'host', N'auto create statistics', N'true'
GO


exec sp_dboption N'host', N'auto update statistics', N'true'
GO


use [host]
GO


/****** Object:  Table [dbo].[GroupAccess]    Script Date: 2004-12-24 13:16:31 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GroupAccess]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[GroupAccess]
GO


/****** Object:  Table [dbo].[GroupAccounts]    Script Date: 2004-12-24 13:16:31 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GroupAccounts]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[GroupAccounts]
GO


/****** Object:  Table [dbo].[GroupIPAccess]    Script Date: 2004-12-24 13:16:31 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GroupIPAccess]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[GroupIPAccess]
GO


/****** Object:  Table [dbo].[UserAccess]    Script Date: 2004-12-24 13:16:31 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[UserAccess]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[UserAccess]
GO


/****** Object:  Table [dbo].[UserAccounts]    Script Date: 2004-12-24 13:16:31 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[UserAccounts]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[UserAccounts]
GO


/****** Object:  Table [dbo].[UserIPAccess]    Script Date: 2004-12-24 13:16:31 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[UserIPAccess]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[UserIPAccess]
GO


/****** Object:  Table [dbo].[GroupAccess]    Script Date: 2004-12-24 13:16:34 ******/
CREATE TABLE [dbo].[GroupAccess] (
[IndexNo] [int] NULL ,
[UserName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[Access] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
[GAid] [int] IDENTITY (1, 1) NOT NULL
) ON [PRIMARY]
GO


/****** Object:  Table [dbo].[GroupAccounts]    Script Date: 2004-12-24 13:16:36 ******/
CREATE TABLE [dbo].[GroupAccounts] (
[UserName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[Access] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
[Notes] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
[GAsId] [int] IDENTITY (1, 1) NOT NULL
) ON [PRIMARY]
GO


/****** Object:  Table [dbo].[GroupIPAccess]    Script Date: 2004-12-24 13:16:36 ******/
CREATE TABLE [dbo].[GroupIPAccess] (
[IndexNo] [int] NULL ,
[UserName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[Access] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
[GIpAid] [int] IDENTITY (1, 1) NOT NULL
) ON [PRIMARY]
GO


/****** Object:  Table [dbo].[UserAccess]    Script Date: 2004-12-24 13:16:37 ******/
CREATE TABLE [dbo].[UserAccess] (
[IndexNo] [int] NULL ,
[UserName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[Access] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
[UAid] [int] IDENTITY (1, 1) NOT NULL
) ON [PRIMARY]
GO


/****** Object:  Table [dbo].[UserAccounts]    Script Date: 2004-12-24 13:16:37 ******/
CREATE TABLE [dbo].[UserAccounts] (
[id] [int] IDENTITY (1, 1) NOT NULL ,
[UserName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[Password] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[Disable] [bit] NOT NULL ,
[Access] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
[ChangePass] [bit] NOT NULL ,
[PassType] [tinyint] NOT NULL ,
[Expiration] [smalldatetime] NOT NULL ,
[ExpirationType] [tinyint] NOT NULL ,
[SKey] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[RelPaths] [bit] NOT NULL ,
[HomeDir] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
[MessageFile] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
[MaxUsers] [int] NOT NULL ,
[MaxUp] [int] NOT NULL ,
[MaxDown] [int] NOT NULL ,
[RatioUp] [int] NULL ,
[RatioDown] [int] NULL ,
[RatioCredit] [float] NULL ,
[RatioType] [tinyint] NULL ,
[QuotaEnable] [bit] NOT NULL ,
[QuotaMax] [int] NOT NULL ,
[QuotaCurrent] [int] NOT NULL ,
[Groups] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
[Privilege] [tinyint] NOT NULL ,
[LockHomeDir] [bit] NOT NULL
) ON [PRIMARY]
GO


/****** Object:  Table [dbo].[UserIPAccess]    Script Date: 2004-12-24 13:16:38 ******/
CREATE TABLE [dbo].[UserIPAccess] (
[IndexNo] [smallint] NULL ,
[UserName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[Access] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
[UIpAid] [int] IDENTITY (1, 1) NOT NULL
) ON [PRIMARY]
GO


ALTER TABLE [dbo].[GroupAccess] WITH NOCHECK ADD
CONSTRAINT [PK_GroupAccess] PRIMARY KEY  CLUSTERED
(
  [GAid]
)  ON [PRIMARY]
GO


ALTER TABLE [dbo].[GroupAccounts] WITH NOCHECK ADD
CONSTRAINT [PK_GroupAccounts] PRIMARY KEY  CLUSTERED
(
  [GAsId]
)  ON [PRIMARY]
GO


ALTER TABLE [dbo].[GroupIPAccess] WITH NOCHECK ADD
CONSTRAINT [PK_GroupIPAccess] PRIMARY KEY  CLUSTERED
(
  [GIpAid]
)  ON [PRIMARY]
GO


ALTER TABLE [dbo].[UserAccess] WITH NOCHECK ADD
CONSTRAINT [PK_UserAccess] PRIMARY KEY  CLUSTERED
(
  [UAid]
)  ON [PRIMARY]
GO


ALTER TABLE [dbo].[UserAccounts] WITH NOCHECK ADD
CONSTRAINT [PK_UserAccounts] PRIMARY KEY  CLUSTERED
(
  [id]
)  ON [PRIMARY]
GO


ALTER TABLE [dbo].[UserIPAccess] WITH NOCHECK ADD
CONSTRAINT [PK_UserIPAccess] PRIMARY KEY  CLUSTERED
(
  [UIpAid]
)  ON [PRIMARY]
GO


ALTER TABLE [dbo].[UserAccounts] WITH NOCHECK ADD
CONSTRAINT [DF_UserAccounts_Disable] DEFAULT (0) FOR [Disable],
CONSTRAINT [DF_UserAccounts_ChangePass] DEFAULT (1) FOR [ChangePass],
CONSTRAINT [DF_UserAccounts_PassType] DEFAULT (0) FOR [PassType],
CONSTRAINT [DF_UserAccounts_ExpirationType] DEFAULT (1) FOR [ExpirationType],
CONSTRAINT [DF_UserAccounts_RelPaths] DEFAULT (0) FOR [RelPaths],
CONSTRAINT [DF_UserAccounts_MaxUsers] DEFAULT ((-1)) FOR [MaxUsers],
CONSTRAINT [DF_UserAccounts_MaxUp] DEFAULT (0) FOR [MaxUp],
CONSTRAINT [DF_UserAccounts_MaxDown] DEFAULT (0) FOR [MaxDown],
CONSTRAINT [DF_UserAccounts_RatioUp] DEFAULT (1) FOR [RatioUp],
CONSTRAINT [DF_UserAccounts_RatioDown] DEFAULT (1) FOR [RatioDown],
CONSTRAINT [DF_UserAccounts_RatioCredit] DEFAULT (0) FOR [RatioCredit],
CONSTRAINT [DF_UserAccounts_RatioType] DEFAULT (0) FOR [RatioType],
CONSTRAINT [DF_UserAccounts_QuotaEnable] DEFAULT (1) FOR [QuotaEnable],
CONSTRAINT [DF_UserAccounts_QuotaMax] DEFAULT (0) FOR [QuotaMax],
CONSTRAINT [DF_UserAccounts_QuotaCurrent] DEFAULT (0) FOR [QuotaCurrent],
CONSTRAINT [DF_UserAccounts_Privilege] DEFAULT (0) FOR [Privilege],
CONSTRAINT [DF_UserAccounts_LockHomeDir] DEFAULT (1) FOR [LockHomeDir],
CONSTRAINT [IX_UserAccounts] UNIQUE  NONCLUSTERED
(
  [UserName]
)  ON [PRIMARY]
GO



exec sp_addextendedproperty N'MS_Description', N'目录权限', N'user', N'dbo', N'table', N'UserAccounts', N'column', N'Access'
GO
exec sp_addextendedproperty N'MS_Description', N'是否允许更改密码', N'user', N'dbo', N'table', N'UserAccounts', N'column', N'ChangePass'
GO
exec sp_addextendedproperty N'MS_Description', N'帐号是否禁用', N'user', N'dbo', N'table', N'UserAccounts', N'column', N'Disable'
GO
exec sp_addextendedproperty N'MS_Description', N'过期时间', N'user', N'dbo', N'table', N'UserAccounts', N'column', N'Expiration'
GO
exec sp_addextendedproperty N'MS_Description', N'过期类型', N'user', N'dbo', N'table', N'UserAccounts', N'column', N'ExpirationType'
GO
exec sp_addextendedproperty N'MS_Description', N'用户组', N'user', N'dbo', N'table', N'UserAccounts', N'column', N'Groups'
GO
exec sp_addextendedproperty N'MS_Description', N'主目录', N'user', N'dbo', N'table', N'UserAccounts', N'column', N'HomeDir'
GO
exec sp_addextendedproperty N'MS_Description', N'是否锁定在主目录', N'user', N'dbo', N'table', N'UserAccounts', N'column', N'LockHomeDir'
GO
exec sp_addextendedproperty N'MS_Description', N'最大下载速率', N'user', N'dbo', N'table', N'UserAccounts', N'column', N'MaxDown'
GO
exec sp_addextendedproperty N'MS_Description', N'最大上传速率', N'user', N'dbo', N'table', N'UserAccounts', N'column', N'MaxUp'
GO
exec sp_addextendedproperty N'MS_Description', N'最大登陆用户数', N'user', N'dbo', N'table', N'UserAccounts', N'column', N'MaxUsers'
GO
exec sp_addextendedproperty N'MS_Description', N'消息文件', N'user', N'dbo', N'table', N'UserAccounts', N'column', N'MessageFile'
GO
exec sp_addextendedproperty N'MS_Description', N'密码类型', N'user', N'dbo', N'table', N'UserAccounts', N'column', N'PassType'
GO
exec sp_addextendedproperty N'MS_Description', N'密码', N'user', N'dbo', N'table', N'UserAccounts', N'column', N'Password'
GO
exec sp_addextendedproperty N'MS_Description', N'管理权限', N'user', N'dbo', N'table', N'UserAccounts', N'column', N'Privilege'
GO
exec sp_addextendedproperty N'MS_Description', N'当前配额', N'user', N'dbo', N'table', N'UserAccounts', N'column', N'QuotaCurrent'
GO
exec sp_addextendedproperty N'MS_Description', N'启用磁盘配额', N'user', N'dbo', N'table', N'UserAccounts', N'column', N'QuotaEnable'
GO
exec sp_addextendedproperty N'MS_Description', N'最大配额', N'user', N'dbo', N'table', N'UserAccounts', N'column', N'QuotaMax'
GO
exec sp_addextendedproperty N'MS_Description', N'下载比率', N'user', N'dbo', N'table', N'UserAccounts', N'column', N'RatioDown'
GO
exec sp_addextendedproperty N'MS_Description', N'上传比率', N'user', N'dbo', N'table', N'UserAccounts', N'column', N'RatioUp'
GO
exec sp_addextendedproperty N'MS_Description', N'用户名', N'user', N'dbo', N'table', N'UserAccounts', N'column', N'UserName'



GO

ftp.cs代码:

using System;
using System.Web.Security;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;

namespace host
{
/// <summary>
/// ftp 的摘要说明。
/// </summary>
public class ftp
{
  private SqlConnection conHost;


  public string UserName;//用户名
  public string Password;//密码
  public bool Disable;//禁用帐号 true:禁用帐号 false:启用帐号
  public string Access;//目录/IP访问规则
  public byte PassType;//密码类型 0:规则密码 1:OTP S/KEY MD4 2:OTP S/KEY MD5
  public bool ChangePass;//允许修改密码 true:允许 false:禁止
  public DateTime Expiration;//过期时间
  public byte ExpirationType;//过期类型 1:删除 2:禁用
  public string SKey;
  public bool RelPaths;//需要安全连接 true:需要 false:不需要
  public string HomeDir;//主目录
  public string MessageFile;//消息文件
  public int MaxUsers;//最大用户数
  public int MaxUp;//最大上传速率
  public int MaxDown;//最大下载速率
  public byte RatioType;//比率类型
  public int RatioUp;//上传率
  public int RatioDown;//下载率
  public float RatioCredit;//比率信任
  public bool QuotaEnable;//允许配额 true:允许 false:禁止
  public int QuotaMax;//最大配额
  public int QuotaCurrent;//当前配额
  public string Groups;//用户组
  public byte Privilege;//管理权限 0:没有权限 1:系统管理员 2:组管理员 3:域管理员 4:只读管理员
  public bool LockHomeDir;//锁定于主目录 true:锁定 false:不锁定

  public ftp()
  {
   //
   // TOD 在此处添加构造函数逻辑
   //
   UserName = "guest";
   Password = "guest";
   Disable = false;
   Access = "";
   PassType = 0;
   ChangePass = true;
   Expiration = DateTime.Now.Date;
   ExpirationType = 1;
   SKey = "";
   RelPaths = false;
   HomeDir = "";
   MessageFile = "";
   MaxUsers = 1;
   MaxUp = 100 * 1024;//100K
   MaxDown = 100 * 1024;//100K
   RatioType = 0;
   RatioUp = 1;
   RatioDown = 1;
   RatioCredit = 0;
   QuotaEnable = true;
   QuotaMax = 10 * 1024 * 1024;//10M
   QuotaCurrent = 0;
   Groups = "";
   Privilege = 0;
   LockHomeDir = true;

   conHost = new SqlConnection( ConfigurationSettings.AppSettings["conString"] );
   conHost.Open();
  }

  ~ftp()
  {
   conHost.Close();
  }

  public void Add()
  {
   //添加帐号
   SqlCommand cmdAdd = new SqlCommand( "insert into UserAccounts (UserName,Password,Disable,Access,ChangePass,PassType,Expiration,ExpirationType,SKey,RelPaths,HomeDir,MessageFile,MaxUsers,MaxUp,MaxDown,RatioUp,RatioDown,RatioCredit,RatioType,QuotaEnable,QuotaMax,QuotaCurrent,Groups,Privilege,LockHomeDir) values(@UserName,@Password,@Disable,@Access,@ChangePass,@PassType,@Expiration,@ExpirationType,@SKey,@RelPaths,@HomeDir,@MessageFile,@MaxUsers,@MaxUp,@MaxDown,@RatioUp,@RatioDown,@RatioCredit,@RatioType,@QuotaEnable,@QuotaMax,@QuotaCurrent,@Groups,@Privilege,@LockHomeDir)", conHost );

   cmdAdd.Parameters.Add( "@UserName", UserName );
   cmdAdd.Parameters.Add( "@Password", pass() );
   cmdAdd.Parameters.Add( "@Disable", Disable );
   cmdAdd.Parameters.Add( "@Access", Access );
   cmdAdd.Parameters.Add( "@ChangePass", ChangePass );
   cmdAdd.Parameters.Add( "@PassType", PassType );
   cmdAdd.Parameters.Add( "@Expiration", Expiration );
   cmdAdd.Parameters.Add( "@ExpirationType", ExpirationType );
   cmdAdd.Parameters.Add( "@SKey", SKey );
   cmdAdd.Parameters.Add( "@RelPaths", RelPaths );
   cmdAdd.Parameters.Add( "@HomeDir", HomeDir );
   cmdAdd.Parameters.Add( "@MessageFile", MessageFile );
   cmdAdd.Parameters.Add( "@MaxUsers", MaxUsers );
   cmdAdd.Parameters.Add( "@MaxUp", MaxUp );
   cmdAdd.Parameters.Add( "@MaxDown", MaxDown );
   cmdAdd.Parameters.Add( "@RatioUp", RatioUp );
   cmdAdd.Parameters.Add( "@RatioDown", RatioDown );
   cmdAdd.Parameters.Add( "@RatioCredit", RatioCredit );
   cmdAdd.Parameters.Add( "@RatioType", RatioType );
   cmdAdd.Parameters.Add( "@QuotaEnable", QuotaEnable );
   cmdAdd.Parameters.Add( "@QuotaMax", QuotaMax );
   cmdAdd.Parameters.Add( "@QuotaCurrent", QuotaCurrent );
   cmdAdd.Parameters.Add( "@Groups", Groups );
   cmdAdd.Parameters.Add( "@Privilege", Privilege );
   cmdAdd.Parameters.Add( "@LockHomeDir", LockHomeDir );
   //cmdAdd.Parameters.Add( "@",  );

   cmdAdd.ExecuteNonQuery();
  }

  public string pass()
  {
   //密码加密
   Random rnm = new Random();
   char a = (char)(rnm.Next( 97, 123 ));
   char b = (char)(rnm.Next( 97, 123 ));
   string password = string.Format("{0}{1}{2}", a, b, Password );
   password = FormsAuthentication.HashPasswordForStoringInConfigFile( password, "md5" );
   password = string.Format( "{0}{1}{2}", a, b, password.ToUpper() );
   return password;
  }

  public bool modifypass( string oldpass, string newpass )
  {
   //修改密码
   return true;
  }
}
}

例子WebForm1.aspx.cs:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Web.Security;

namespace host
{
/// <summary>
/// WebForm1 的摘要说明。
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
  protected System.Web.UI.WebControls.Label Label1;

  private void Page_Load(object sender, System.EventArgs e)
  {
   // 在此处放置用户代码以初始化页面
   ftp test = new ftp();
   test.UserName = "t";
   test.Password = "t";
   test.Access = "D://wwwroot//test|RWAMLCDP";
   test.HomeDir = "D://wwwroot//test";
   test.Groups = "test";
   test.Add();
   Label1.Text = "成功";
  }

  #region Web 窗体设计器生成的代码
  override protected void OnInit(EventArgs e)
  {
   //
   // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
   //
   InitializeComponent();
   base.OnInit(e);
  }
  
  /// <summary>
  /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  /// 此方法的内容。
  /// </summary>
  private void InitializeComponent()
  {    
   this.Load += new System.EventHandler(this.Page_Load);

  }
  #endregion
}
}
相关图片:
建立DNS:
建立DNS
2、建立域:
建立域
3、配制Serv-U:
配置Serv-U


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值