Creating Users for Proftpd Server in PHP

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

I read on the 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

    Author Comment

    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.

    LVL 5

    Accepted Solution


    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
    LVL 5

    Expert Comment

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

    Author Comment

    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

    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

    How does your email signature look on mobiles?

    Do your employees use mobile devices to reply to emails? With mobile becoming increasingly important to the business world, it is in your best interest to make sure that your email signature looks great across all types of devices.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Access License Server from 2 locations 4 52
    Unable to Connect to LDAP Server 2 29
    PHP and SOAP Woes 7 27
    Php string function 3 11
    I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
    If, like me, you have a lot of Dell servers in the estate you manage this article should save you a little time. When attempting to login to iDrac on any server I would be presented with two errors. The first reads "Do you want to run this applicati…
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    The viewer will learn how to count occurrences of each item in an array.

    746 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now