Use ODBC database to manage ftp users of Serv-U and related ASP programming [source code example download]

Source: Internet
Author: User

Serv-U is a widely used FTP server software. It supports all Windows series such as 3x, 9x, me, NT, and 2 K. You can set multiple FTP servers, set logon user permissions, log on to the main directory, and set the space size. The functions are complete. It provides complete security features, supports ssl ftp transmission, and supports SSL encrypted connections between multiple Serv-U and FTP clients to protect your data security.

Serv-U supports user and user group settings based on ODBC databases, which provides a good interface for programming based on Serv-U. Next we will introduce how to implement it.

1. Use ODBC database to manage Serv-U
Prerequisites: Enterprise Edition Serv-U (4.1 or later) supports ODBC. Common supported databases include access, MySQL, Oracle, and MSSQL.

Some database examples are provided on the English official website Serv-U. Download is provided on this site. Please select:
· Access example: Ms access ODBC example
· Ms SQL example: ms SQL Server ODBC example
· MySQL example: MySQL ODBC example
· SQL file for creating table structures in Oracle: Oracle database for use with Serv-U

The following uses ms SQL as an example to describe how to use it.
1. After Serv-U Enterprise Edition (Version 4.1 and later) is installed, create a new domain. In Step 4, select "store in ODBC database" for the domain type ",

2. Download the ms SQL Server ODBC example sample package and obtain the createservutables. SQL (used to create the corresponding Serv-U table structure in MSSQL) file.

Line to create the following six tables:
· FTP _ users
· FTP _ userips
· FTP _ useraccess
· FTP _ groups
· FTP _ groupips
· FTP _ groupaccess
Ftp_users is the most important table for storing users.

3. Establish ODBC. The sample process is as follows:
(1) Add the system DSN (system data source), select SQL Server, and fill in the data source name and server (local is used on the local machine)

(2) The logon authentication method is determined based on your MSSQL settings. Here we use the SQL authentication method to log on.

(3) change the database to create the Serv-U table database for you, confirm, and complete ODBC settings. Now that you have a system data source named Serv-U, remember the name and logon user and password.

4. Configure Serv-U
(1) Disable Serv-U, open the add-to-ini.txt file from the ms SQL Server ODBC example package, and copy the followingCode:
[Domain1]
Odbctables = ftp_users | ftp_groups | ftp_useraccess | ftp_groupaccess | ftp_userips | ftp_groupips
Authorization = ftpusername | ftppassword | skey | dirhome | disabled | hidehidden | disabled | changepassword | quotaenable | disabled | speedlimitup | speedlimitdown | disabled | timeoutidle | timeoutsession | ratioup | ratiodown | ratiocredit | quotacurrent | quotamax | expiration | privilege | ftppasswordtype | ratiotype | groups | notes | indexno

(2) Open the installation directory of Serv-U, find the servudaemon. ini file, and replace the corresponding [domain1] and subsequent settings with the above Code.

(3) re-open your Serv-U and find the domain you just created. You should be able to see the ODBC link settings in ODBC settings, except for the ODBC source name, account, and password, other table and column names have been set.


(4) Fill in your ODBC source name, account, password, and application settings. If your settings are correct, the icons in front of the domain will no longer be prohibited, indicates that it has been set.

(5) create a user and check whether the user exists in your ftp_users table. If no problem exists, you have completed the ODBC settings of Serv-U.

Ii. Programming to Implement ODBC management for Serv-U users
With the database, it is very simple and easy to manage Serv-U users by programming. The only difficulty lies in the encryption of passwords.
We know three types of Serv-U encryption.AlgorithmBy default, it is a 32-bit MD5 encryption algorithm, which is different from some 16-bit and 64-bit encryption algorithms. Therefore, we need to use 32-bit

The MD5 encryption algorithm is used to encrypt passwords. The following uses ASP programming as an example:

Use the following two functions to encrypt the password. The 32-bit MD5 encryption file is downloaded here.

Function serupassencode (strpass)
Dim char1, char2, seed, Prepass, encodepass, finalpass
If isnull (strpass) or strpass = "" Then exit function
Char1 = CHR (RAND (97,122 ))
Char2 = CHR (RAND (97,122 ))
Seed = char1 & char2
Prepass = Seed & strpass
Encodepass = ucase (MD5 (Prepass) '32-bit MD5
Finalpass = Seed & encodepass
Serupassencode = finalpass
End Function
Function rand (n, m)
Dim a, B, T
A = N: B = m
If B <A then t = B: B = A: A = T
Randomize
Rand = int (RND * (B-A + 1) +)
End Function
This article is completely original. Please respect the work of the author. Please indicate the source for reprinting. Thank you.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.