Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > Tips/Tricks/Mods

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 20th May 2011, 01:59
holtmichael09 holtmichael09 is offline
Junior Member
Join Date: May 2011
Posts: 3
Thanks: 0
Thanked 1 Time in 1 Post
Post Proftpd for ISPConfig 3 Tutorial (Debian)

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.

Tutorial (do everything as root user or be sure to add sudo to every comamnd):

Run these Commands:
apt-get remove pure-ftpd-common pure-ftpd-mysql
apt-get install proftpd proftpd-mod-mysql
Install as standalone

Create ftpgroup & ftpuser
groupadd -g 2001 ftpgroup
useradd -u 2001 -s /bin/false -d /bin/null -c "proftpd user" -g ftpgroup ftpuser
Modify MySQL Database
mysql -u root -p
Use dbispconfig
Run Query
ALTER TABLE `ftp_user` ADD `shell` VARCHAR( 18 ) NOT NULL DEFAULT '/sbin/nologin',
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');
Exit MySQL
Edit /usr/local/ispconfig/interface/lib/config.inc.php
nano /usr/local/ispconfig/interface/lib/config.inc.php
Search for db_password and make note of the password for later.

Edit /etc/proftpd/proftpd.conf
nano /etc/proftpd/proftpd.conf
#Include /etc/proftpd/sql.conf
Change To:
Include /etc/proftpd/sql.conf
Edit: Edit /etc/proftpd/sql.conf
nano /etc/proftpd/sql.conf
Erase all contents of the file

Insert the following code:
# 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>
# Choose a SQL backend among MySQL or PostgreSQL.
# Both modules are loaded in default configuration, so you have to specify the backend
# or comment out the unused module in /etc/proftpd/modules.conf.
# Use 'mysql' or 'postgres' as possible values.
#SQLBackend        mysql
#SQLEngine on
#SQLAuthenticate on
# Use both a crypted or plaintext password
#SQLAuthTypes Crypt Plaintext
# Use a backend-crypted or a crypted password
#SQLAuthTypes Backend Crypt
# Connection
#SQLConnectInfo proftpd@sql.example.com proftpd_user proftpd_password
# Describes both users/groups tables
#SQLUserInfo users userid passwd uid gid homedir shell
#SQLGroupInfo groups groupname gid members
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

Be sure to change _insertpasswordhere_ to the password we retrieved earlier.
If your mysql database is stored on a server other than localhost be sure to modify appropriately.

Edit: /etc/proftpd/modules.conf

nano /etc/proftpd/modules.conf
#LoadModule mod_sql.c
Change To:
LoadModule mod_sql.c
#LoadModule mod_sql_mysql.c
Change To:
LoadModule mod_sql_mysql.c
/etc/init.d/proftpd restart
Now we have to change one of the ispconfig files. This isn't ideal, since an update will reverse the changes, but it is the only way to make proftpd work that i could find.

Edit /usr/local/ispconfig/interface/web/sites/ftp_user_edit.php
nano /usr/local/ispconfig/interface/web/sites/ftp_user_edit.php
                $uid = $web["system_user"];
                $gid = $web["system_group"];
Replace With:
		$userinfo = posix_getpwnam($web["system_user"]);
		$uid = $userinfo['uid'];
		$gid = $userinfo['gid'];
Find (2nd time):
                $uid = $web["system_user"];
                $gid = $web["system_group"];
Replace With:
		$userinfo = posix_getpwnam($web["system_user"]);
		$uid = $userinfo['uid'];
		$gid = $userinfo['gid'];
And now your all Done. If you were logged in while modifying this file, you'll need to log out then log back in because of the way ISPConfig works.

Special thanks goes out to Falko and his Tutorial Virtual Hosting With Proftpd And MySQL (Incl. Quota) On Debian Lenny. His tutorial laid the base for creating this.

Last edited by holtmichael09; 20th May 2011 at 02:25.
Reply With Quote
The Following User Says Thank You to holtmichael09 For This Useful Post:
till (20th May 2011)
Sponsored Links


ispconfig 3, proftpd

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[debian 5 + ispconfig 3] Unable to send mail tanakskool HOWTO-Related Questions 6 4th November 2009 19:20
Booting On PXE And On A Customized Debian System sebastienp HOWTO-Related Questions 7 30th July 2009 22:13
Bind Failed christoph2k HOWTO-Related Questions 4 28th April 2007 01:57
Im thinking about throwing proftpd to the trashcan danf.1979 Installation/Configuration 2 23rd December 2005 10:27
e-mail problem!!! Debian 3.1 maroonworks Installation/Configuration 18 6th December 2005 15:42

All times are GMT +2. The time now is 07:49.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.