Link to home
Start Free TrialLog in
Avatar of ParadyneDesigns
ParadyneDesigns

asked on

Creating Users for Proftpd Server in PHP

Hi

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.
Avatar of ParadyneDesigns
ParadyneDesigns

ASKER

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.

ASKER CERTIFIED SOLUTION
Avatar of administradores
administradores

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Also you can use php to connect via ssh and create the user from the shell.
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.
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).