Proftpd + mysql + quota

xiaoxiao2021-03-06  124

Find a lot of brothers on the Internet to worry about the problems of installing ProftPD MySQL Quota. I will sort out my installation process, of course, it is not original. It also provides related software packs permanently downloaded, and mysql / php / apache installation is free. My mysql is installed using the source code! related software: ----------------------------------------------- ---------------- PrOFTPD-1.2.9.tar.gz proprofd-mod-quotatab-1.2.11.tar.gz ftpdb.sql proFTpd.conf ------ -------------------------------------------------- ------- Proceed as follows:

Code: vi /etc/ld.so.conf Add: / usr / local / mysql / lib tar zvxf proFTPD-1.2.9.tar.gz tar zvxf proFTPD-mod-quotatab-1.2.11.tar.gz cp mod_quotatab / * .c proFTPD-1.2.9 / contrib / cp mod_quotatab / *. h proFTPD-1.2.9 / contrib / vi proFTPD-1.2.9 / contrib / mod_sql_mysql.c #include Modify MySQL.H's actual path CD proFTPD-1.2.9 ./configure / - prefix = / usr / local / proFTPD / - with-mod_SQL_MYSQL: MOD_SQL_MYSQL: MOD_QUTATAB /: MOD_QUTATAB_SQL: MOD_RATIO / - WITH-INCLUDES = / usr / local / mysql / include / - with-libraries = / usr / local / mysql / lib make make install cp proFTPD-1.2.9 / contrib / dist / rpm / proFTPD.INIT.D / ETC /rc.d/init.d/proftpd vi /etc/rc.d/init.d/proftpd modification: path = "$ path: / usr / local / proFTPD / sbin" chmod 755 /etc/rc.d/init .d / proftpd chkconfig --LEVEL 3 PrOFTPD ON GROUPADD -G 5500 ftpgroup addUser -u 5500 -s / bin / false -d / bin / null -c "proFTPD user" -g ftpgroup ftpuser then configures your proFd.conf last It is started. / usr / local / proFTPD / SBIN / PROFTPD

------------------------------ - proF ---------------- ------------------

Code: # this is a Basic Protepd Configuration File (rename it to # 'protepd.conf' for actual use. It establishes a single server # and a single anonymous login. It assumes That You Have a user / group # "Nobody" and "ftp" for normal operation and anon. ServerName "ltsnet" ServerType standalone DefaultServer on # Port 21 is the standard FTP port. Port 21 # Umask 022 is a good standard umask to prevent new dirs and files # from being group and world writable. Umask 022 # to prevent DoS attacks, set the maximum number of child processes # to 30. If you need to allow more than 30 concurrent connections # at once, simply increase this value. Note that this ONLY works # in standalone mode, in inetd mode you should use an inetd server # that allows you to limit maximum number of processes per service # (such as xinetd). MaxInstances 30 # Set the user and group under which the server will run. User nobody Group nobody # To cause every FTP user to be "jailed" (chrooted) into their home # directory, uncomment this line. ServerIdent off DisplayLogin welcome.msg DefaultRoot ~ # Normally, we want files to be overwriteable. AllowOverwrite on # A basic anonymous configuration, no upload directories. If you do not # want anonymous users, simply delete this entire section. User ftp Group ftp # We want clients to be able to login with "Anonymous" As Well AS "ftp" Useralias Anonymous ftp # limited The maximum number of anonymous logins maxclients 10 # we want '

welcome.msg 'displayed at login, and' .message 'displayed # in each newly chdired directory. DisplayLogin welcome.msg DisplayFirstChdir .message # Limit WRITE everywhere in the anonymous chroot DenyAll SQLAuthTypes Backend Plaintext SQLAuthenticate users * groups * SQLConnectInfo ftpdb @ localhost root 123456 SQLUserInfo ftpuser userid passwd uid gid homedir shell SQLGroupInfo ftpgroup groupname gid members SQLHomedirOnDemand on SQLLog PASS updatecount SQLNamedQuery updatecount UPDATE "count = count 1, accessed = now () WHERE userid = ' % u ' "ftpuser SQLLog STOR, DELE modified SQLNamedQuery modified UPDATE" modified = now () WHERE userid ='% u ' "ftpuser QuotaEngine on QuotaDirectoryTally on QuotaDisplayUnits Mb QuotaShowQuotas on QuotaLog" / var / log / quota "SQLNamedQuery get-quota- Limit select "name, quota_type, per_session, limited_type, bytes_in_avail, bytes_out_avail, bytes_axfer_avail, files_in_avail, files_out_avail, files_xfer_avail from ft pquotalimits WHERE name = '% {0}' AND quota_type = '% {1}' "SQLNamedQuery get-quota-tally SELECT" name, quota_type, bytes_in_used, bytes_out_used, bytes_xfer_used, files_in_used, files_out_used, files_xfer_used FROM ftpquotatallies WHERE name = '% {0} 'AND quota_type ='% {1} ' "SQLNamedQuery update-quota-tally UPDATE" bytes_in_used = bytes_in_used % {0}, bytes_out_used = bytes_out_used % {1}, bytes_xfer_used = bytes_xfer_used % {2}, files_in_used = FILES_IN_USED % {3}, files_out_used = files_out_used % {4}, files_xfer_used =

FILES_XFER_USED % {5} where name = '% {6}' and quota_type = '% {7}' "ftpquotatallies sqlnamedquery insert-quota-Tally Insert"% {0},% {1},% {2},% {3},% {4},% {5},% {6},% {7} "ftpquotatallies quotalimittable sql: / get-quota-limited quotatallytable sql: / get-quota-tally / update-quota-tally / Insert-quota-tally built FTPDB libraries, import ftpdb.sql in phpMyAdmin is OK. ------------------------------- ------- ftpdb.sql ---------------------------------

Code: # Table structure` # Create Table `ftpgroup` (` Groupname` Varchar (16) Not null default ', `Gid` Smallint (6) Not null default' 5500 ',` Members` VARCHAR (16) NOT NULL Default '', Key `Groupname` (` Groupname`)) type = myisam comment = 'proftp group table'; # # Export table in the table in the table` # Insert Into `ftpGroup` Values ​​('ftpgroup', 5500 , 'ftpuser'); # ------------------------------------------ ------------- # Table Structure `ftpquotalimits` # Create Table` ftpquotalimits` (`Name` VARCHAR (30) Default Null,` Quota_Type` Enum ('user', 'Group' , 'class', 'all') Not null default 'user', `per_session` Enum ('false', 'true') Not null default 'false',` limit_type` enum ('Soft', 'Hard') Not NULL default 'soft', `bytes_in_avail` float NOT NULL default '0',` bytes_out_avail` float NOT NULL default '0', `bytes_xfer_avail` float NOT NULL default '0',` files_in_avail` int (10) unsigned NOT NULL default '0', `files_out_avail` int (10) unsigned not null default '0',` files_xfer_avail` int (10) unsigned n Ot NULL Default '0') Type = Myisam; # # Export Table Data `ftpquotalimits` # Insert Into` ftpquotalimits` Values ​​('Test', 'User', 'True', 'Hard', '9e 06' , '2000', '9e 09', 2000, 2000, 2000); # ------------------------------- ------------------------- # Table Structure `ftpquotatallies` # CREATE TABLE`

Ftpquotatallies` (`Name` VARCHAR (30) Not null default ',` quota_type` Enum (' user ',' group ',' class', 'all') Not null default 'user', `Bytes_in_used` Float Not Null default '0', `bytes_out_used` float NOT NULL default '0',` bytes_xfer_used` float NOT NULL default '0', `files_in_used` int (10) unsigned NOT NULL default '0',` files_out_used` int (10) unsigned NOT NULL Default '0', `files_xfer_used` int (10) Unsigned Not Null Default '0') Type = Myisam; # # 导 导 的 数据 的 数据 中` `` `` `````` ',' 2000 ',' 2000 ',' 2000 ', 2000, 2000, 2000); # ---------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------- # Create Table `ftpuser` # Create Table` ftpuser` # Create Table `ftpuser` # Create Table` ftpuser`( 10) Unsigned not null auto_increment, `userid` VARCHAR (32) Not null default ',` passwd` Varchar (32) Not null default', `uid` smallint (6) Not null default '5500',` gid` smallint 6) Not null default '5500', `Homedir` VARCHAR (255) Not null default ',` shell` VARCHAR (16) Not Nu Ll default '/ sbin / nologin', `count` int (11) Not null default '0',` Accessed` DateTime Not Null Default '0000-00-00 00:00:00', `Modified` DateTime Not Null Default` DEFA '0000-00-00 00:00:00', primary key (`ID`)) type = myisam comment = 'proftp user table' auto_increment = 3; # # exported the data in the table` # Insert Into`

FTPUSER` VALUES (1, 'Test', '123456', 5500, 5500, '/ home / test', '/ sbin / nologin', 36, '2004-09-28 13:07:41', '2004- 09-28 13:07:42 '); quotalimits table

Code: Name: - User Account Quota Type: - User, Group, Class, All (We Use User) Per_Session: - True OR FALSE (We Use true) Limit_Type: - Hard limit OR Soft restrictions (we generally use hard limit) BYTES_IN_AVAIL : - Allow uploaded bytes bytes_out_avail: - Allow downloaded bytes_xfer_avail: - Allows the number of bytes (including upload / download) files_in_avail: - Allow upload file_out_avail: - Allow download files_xfer_avail: - Allowed files to be transferred (including upload / download)

It should be no problem with these steps. Honestly use the MySQL and Quota modules to verify the user and set disk limit, but I always feel that it is not perfect, because in this method, there is no field of permissions in the database table, so I say that the authority of the corresponding user is actually used. The user is Mysql corresponding to the UID and GID to control the permissions. If the mysql database can completely control the permissions.

转载请注明原文地址:https://www.9cbs.com/read-102367.html

New Post(0)