Re: setting up FTP account names via PHP
| From: | Nathan Rixham | Date: | Tue, 06 Jan 2009 10:49:48 +0000 |
| Subject: | Re: setting up FTP account names via PHP | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-285503@lists.php.net to get a copy of this message | ||
Ashley Sheridan wrote:
On Mon, 2009-01-05 at 16:16 +0100, Merlin Morgenstern wrote:I've done similar however opted to make proper shell users with there own home directory; made a couple of nice code snippets that helped things greatly (for a ubuntu box) // creates a new 8 char random password and returns // both the plain text and encrypted pass $pass_parts = explode(" ", $pass = shell_exec('makepasswd --crypt-md5 --minchars=8 --maxchars=8')); $settings['pass_plain'] = trim($pass_parts[0]); $settings['pass_enc'] = trim($pass_parts[1]); // creates a new user ($settings['user']) on the box with password // from above, using SKEL_DIR shell_exec("echo 'pass' | sudo useradd -g GROUP -m -k ".SKEL_DIR." -p".escapeshellcmd(trim($settings['pass_enc']))." ".$settings['user'].''); note: makepasswd is an optional packageIs there a good FTP Daemon that can be recommended for this purpose? pure-ftpd seams out of development since 2006. Jason Pruim wrote:I did this with vsftp and with local user account access turned on. Basically, I had php exec out and create a user, set their password, etc, which would then allow them to ftp in. It was a bit of a nightmare getting the access levels right (as the client wanted them to not only be able to access their own home share but other areas as well, which would all change) but it seems to be working out nicely. Ash www.ashleysheridan.co.ukOn Jan 5, 2009, at 9:55 AM, Merlin Morgenstern wrote:Yes, it would be great if he could use the already existing username and password. It should not be a one time password. I am just now looking into mysql support for pure ftpd. One solution I have in mind is to write the password into the pureftp DB upon signup. That would be the easiest. The other solution to write to a conf file would be OK, too. What do you think?I would look real seriously at making sure both the FTP software, and your website use the same authentication database. Even if it means having to go with a different FTP server, or write your own. That way, if they change their password on the web site, it will update it for the FTP automatically as well. Other then that, No real info to include to help... Sorry for that. -- Jason Pruim japruim@raoset.com 616.399.2355