is this task possible on ubuntu?
I have managed to create vhost via php, I need to create ftp user via php. We are trying to assign a specific directory to internal user who created account via web registration.
I have done this on windows by using filezilla server, where xml can be edited and refresh can be called via php. I need to replicate this for linux.
Thanks
Update:
joe:$1$LX/3.F60$bYdYwsQOYIaWq.Ko.hfI3.:500:101::/home/ftpusers/joe/./::::::1000:10485760::::::
This is the file passwd, well i tried to add another user following the above format, it works, however the same password hash doesn’t work for second account.
I need to get to able to set it password as they specify or without any password. How would I achieve either one of that?
Install PureFTPD by running from commandline:
Then follow the directions on the Ubuntu documentation page for setting up the group, folders, etc:
This is the command that will create a new user however it would be difficult to pass the passwords to the commandline:
So it would be best to create one starting user to generate the users config file located in /etc/pure-ftpd/ Since you said this is for internal use and you did not really care about security you can change the permissions of the file so you can edit it with PHP. Check out it’s format and just have PHP add a new user section to it with the appropriate values. If I recall it is an XML file so using PHP’s XML or DOM functions would work great with it.
Update In Regards To Below Comments:
According to PureFTPD:
Since your string starts with $1 which is for crypt() using MD5 that is what it ended up using. To get a password encrypted do this:
The $1 specifies to use the MD5 hash as that is what your system defaulted to, the $LX/3.F60$ part inside the $’s is your salt.