With the popularization of computer networks, the data backup system solution has the opportunity to spread computer viruses quickly, and the damage to data files is increasingly serious. users often need to back up important personal data remotely. Based on the consideration of multiple users and data privacy, a personal data backup system solution is proposed. It uses the large capacity, high reliability, and high security features of network storage devices to provide users with a certain amount of space to save personal data, at the same time, the permission management of software is used to achieve the confidentiality of personal data.
Currently, FTP server software in Linux mainly includes Wu-FTP and ProFTPD. Wu-FTP is a software pre-installed on Red Hat Linux, but it has many security vulnerabilities. ProFTPD is developed for the weaknesses of Wu-FTP. in addition to improving security, it also has many features, such as easy setup and running in Stand-alone mode. ProFTPD has become one of the most popular FTP server software after Wu-FTP.
ProFTPD uses the Linux user account to manage users before version 1.2, that is, the password file. This method has many shortcomings. compared with database operations, it is complex to add user accounts, modify passwords, and delete accounts, and files cannot support concurrent read/write operations; in Linux, the user account has the Telnet permission, which poses a security risk. the password file can only be modified by the root account. it is technically difficult to modify this file using a browser.
The database management User function is added to ProFTPD version 1.2.4. Currently, only MySQL databases are supported. This account is only applicable to FTP servers, and there is no security risk. The development platform used in this article is a combination of Linux + ProFTPD + MySQL.
Overall design
The system background uses an FTP server to provide users with the file management function. you can use various software that supports the FTP function to operate data files. The solution enables automatic application and password modification for user accounts. network administrators can use a browser to manage functions such as account modification space limit, password modification, and account deletion.
The core of the system is how to dynamically configure ProFTPD using development languages to manage accounts of a large number of users.
Solution details
For more information about ProFTPD installation and configuration files, see the system documentation. this document focuses on database-related information.
1. install ProFTPD
(1) install the MySQL database, create a MySQL installation directory symbol, and connect to/usr/local/mysql.
(2) before compilation, add MySQL and space limit modules to the compilation options. the code is as follows:
#. /Configure -- with-deployed des =/usr/local/mysql/include -- with-libraries =/usr/local/mysql/lib/mysql -- with-modules = mod_ SQL: mod_ SQL _mysql: mod_quota
2. add users
Create the FTPusers database and users table in MySQL to save FTP account information. the code is as follows:
Create table users (
Userid varchar (50) not null,
// User's FTP account name
Password varchar (50 ),
// The user's FTP account password
Uid int (5) DEFAULT '0' not null,
// Uid of the user's main directory
Gid int (5) DEFAULT '20140901' not null,
// Gid of the user's home directory
Homedir varchar (255 ),
// User's main directory
Count int (11) DEFAULT '0 ',
// Login count
Ftime timestamp (14 ),
// Last login time
Shell varchar (255) DEFAULT '/bin/Bash ',
Primary key (userid)
// Primary keyword
);