I’m a new user of ISPConfig and I’ve been playing with Linux for a few years now. My server is currently a VPS with OpenVZ and it won’t allow me to run the default pureftpd that comes with ISPConfig, so I started looking into ProFTPd, and found that it wasn’t very difficult to switch over to using it.
Please Note: This does not include quota support because my VPS does not support it. If you have any suggestions or ideas on how to improve this integration without having to modify ftp_user_edit.php in ISPConfig3 please let me know. These instructions were made running Debian 5.0 Lenny but should work the same for 6.0. For other Distributions these instructions may have to be modified slightly.
Also note: This process worked fine for me on a fresh server and ISPConfig 3 install. Using this on an existing server will require going in and editting/saving every ftp user that has been created, and may cause other issues. I may create a simple php script to do this automatically in the future. I am not responsible for any problems that may arise, so please use this AT YOUR OWN RISK.
apt-get remove pure-ftpd-common pure-ftpd-mysql
apt-get install proftpd proftpd-mod-mysql
Run as standalone
Create Group & User
groupadd -g 2001 ftpgroup
useradd -u 2001 -s /bin/false -d /bin/null -c “proftpd user” -g ftpgroup ftpuser
4 Database Configuration
mysql -u root -p
ALTER TABLE `ftp_user` ADD `shell` VARCHAR( 18 ) NOT NULL DEFAULT
ADD `count` INT( 11 ) NOT NULL DEFAULT ‘0’,
ADD `accessed` DATETIME NOT NULL DEFAULT ‘0000-00-00 00:00:00’,
ADD `modified` DATETIME NOT NULL DEFAULT ‘0000-00-00 00:00:00’;
CREATE TABLE ftp_group (
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’;
INSERT INTO `ftp_group` (`groupname`, `gid`, `members`) VALUES
(‘ftpgroup’, 2001, ‘ftpuser’);
5 ProFTPd Configuration
Find variable db_password.
Note password for later.
Erase all contents and replace with:
# # Proftpd sample configuration for SQL-based authentication. # # (This is not to be used if you prefer a PAM-based SQL authentication) # <IfModule mod_sql.c> DefaultRoot ~ SQLBackend mysql # The passwords in MySQL are encrypted using CRYPT SQLAuthTypes Plaintext Crypt SQLAuthenticate users groups # used to connect to the database # databasename@host database_user user_password SQLConnectInfo dbispconfig@localhost ispconfig _insertpasswordhere_ # Here we tell ProFTPd the names of the database columns in the "usertable" # we want it to interact with. Match the names with those in the db SQLUserInfo ftp_user username password uid gid dir shell # Here we tell ProFTPd the names of the database columns in the "grouptable" # we want it to interact with. Again the names match with those in the db SQLGroupInfo ftp_group groupname gid members # set min UID and GID - otherwise these are 999 each SQLMinID 500 # create a user's home directory on demand if it doesn't exist CreateHome off # Update count every time user logs in SQLLog PASS updatecount SQLNamedQuery updatecount UPDATE "count=count+1, accessed=now() WHERE userid='%u'" ftpuser # Update modified everytime user uploads or deletes a file SQLLog STOR,DELE modified SQLNamedQuery modified UPDATE "modified=now() WHERE userid='%u'" ftpuser RootLogin off RequireValidShell off </IfModule>
Be sure to change _insertpasswordhere_ to the password you retrieved from ISPConfig.
If your MySQL database is on another server, change localhost to represent your MySQL server.
6 ISPConfig 3 Changes
Now we have to change one of the ispconfig files. This isn’t ideal, as if you upgrade to new version you’ll lose the changes, but it is the only way to make proftpd work that I could find.
$uid = $web["system_user"]; $gid = $web["system_group"];
$userinfo = posix_getpwnam($web["system_user"]); $uid = $userinfo['uid']; $gid = $userinfo['gid'];
Note: if you are currently logged into ISPConfig’s web panel you have to log out before changes are registered on your machine.