Creating Users for Proftpd Server in PHP

Posted on 2007-08-05
Medium Priority
Last Modified: 2013-12-02

I read on the http://uk.php.net/ site that it was possible to add users to an FTP server using the ftp_site command.  However, I have found out that the proftpd FTP server uses a different set of SITE commands and none of them appear to include adding users.  The SITE commands for proftpd seem to concentrate on file and directory tasks rather than user based tasks.

I am using a form on my site where people can add a username and password to create a FTP login for my proftp server.  Now I realise that proftp is not going to simply allow the SITE ADDUSER command I am a bit stuck (well, very stuck).

How can I use a php/html form to add a user on a proftpd server?  This is the last hurdle that I now have with my new website and its something I must solve.

I would really really appreicate any help with this one.
Question by:ParadyneDesigns
  • 3
  • 2

Author Comment

ID: 19636871
My current thinking is that there is only two ways to solve this problem.

1.  Ask my server technical support to install proftpd-mysql so that I can write the data direct to a database table.  I have looked at this RPM and its not something I want to try and install myself as I need to remove the old RPM before starting and I am not a server person.

2.  Keep the system as is and put a 24 hour delay on the FTP account creation.  When my users request the FTP upload facility, they enter their details and that is saved to a database and on the screen they are prompted with "your FTP account needs authorisation and should be active within 24 hours".  Then I can create the account manually and send a confirmation email to them letting them know they can now use the FTP system.

Obviously, Option 1 is the way I really want to go but there is a cost involved with my server techs doing this and I have already spent thousands on this project.  Option 2 is less effective and has a delay for my users but is a feasilble workaround until I find something better.

If there are more options then I am very open to hearing them.  I know that my current FTP system stores a file in the etc/proftpd directory which holds the user info, but I cannot find a way to access that file via my php script to be able to update it automatically.

Maybe there is another FTP package that supports virtual hosting and is easier to install than the proftpd-mysql solution which supports the SITE ADDUSER command.  Preferably an RPM that can be easily installed via putty.


Accepted Solution

administradores earned 1500 total points
ID: 19637098

I'd use method 2 using a database to store the ftp user & password then after the ftp account is validated by an admin or mod i'd use a php script or perl or whatever to edit etc/passwd where proftpd search for users. You can also create a php scripts with curl to create it from the CP.

You can also ask to your hosting how mutch would cost to install proftpd-mysql

Expert Comment

ID: 19637106
Also you can use php to connect via ssh and create the user from the shell.

Author Comment

ID: 19640653
I looked at the ssh route but there does not seem to be a command for proftpd in shell to create users!  I do think that route 2 is going to be the way I have to do it which is probably the safest also as I can check user activity before creating and allowing the ftp.

I'll look into the curl method and get back to you.

Author Comment

ID: 19642719
I decided to go with a manual update of the FTP accounts.  In hindsight, this is actually a safer system than having it created automatically as I have set it up so that I generate the passwords and also I can check the user records before allowing access.

I created a complete FTP admin system which is working well, so I am happy.

For the record:-  My server suppliers came back to me with a quote of $150 for the proftpd-mysql install but advised that it would have implications on how my Cpanel worked.  I agreed with them that it is probably a bad idea to upgrade as Cpanel might overwrite the RPM in an update.  My server suppliers are "The Planet" who operate one of the largest server setups in the world and who have been the most reliable I have ever used.  In the past 450 days my server has been down for 2 hours (due to a lose cable).

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Suggested Courses
Course of the Month14 days, 21 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question