Discuss Need create new FTP-account via PHP! in the FTP Help forum on Dev Shed. Need create new FTP-account via PHP! FTP Help forum discussing FTP practices, tips and solutions for problems with FTP on multiple platforms. File Transfer Protocol (FTP) was designed specifically for transferring files from one machine to another.
The ASP Free website provides in-depth information on the latest developer tools available from Microsoft. Our cadre of writers, highly experienced industry experts, reveals the best ways to use established technologies as well as new and emerging technologies. Our coverage of Microsoft's development and administration technologies is among the most respected in the IT industry today.
ASP Free and Iron Speed Designer are giving away $5,500+ in FREE licenses. Iron Speed's RAD CASE toolset can save up to 80% of your coding time. One free license per week, one perpetual license per month! Download and Activate to enter!
Intel® Graphics Performance Analyzers is a powerful tool suite for analyzing and optimizing your games, media, and graphics-intensive applications. Used by some of the best developers on the planet, Intel GPA lets you maximize your app’s performance.
Posts: 2
Time spent in forums: < 1 sec
Reputation Power: 0
Need create new FTP-account via PHP!
I need this script for free hosting service.
When new user signup, I need automatically created FTP account with home dirrectory /home/userlogin and subdomain as userlogin.myhost.com
Can anybody help me?
I have root acces. I try use unix command as "useradd" via php:
system("useradd user -p password -d /home/$user") bot it still not work. Please help!!!
Posts: 2
Time spent in forums: < 1 sec
Reputation Power: 0
I just went through this and ended up using a combination of php and shell scripts. I also took advantage of a program called super. This program has a tab file with entries that detail specific users with programs that they are allowed to run with root privilages. I avoided running apache or php as root to minimize security vulnerabilities. You're on the right track using the system call. I used the system function to run my super app that then referenced the shell script for creating users. This was all done on FreeBSD, the php code was:
I went a step further and used $dur to perform an automatic account expiration, $comp is what company this new user is associated with, and $em is the email account of the person that created the account. When the account is about to be deleted a message is sent to the person that create it.
userSetup.sh is my shell script that actually runs the pw program to create local system accounts. This is a FreeBSD passwd manager command. I'm not sure what the equivalent would be for linux.
The line within the shell script that creates the local account is:
echo $4 | /usr/sbin/pw useradd -q -h 0 -n $3 -s /bin/none -d /home/$3 -m
The options here are:
-q quite mode, -h 0 accept input for password from stdin, -n the users name, -s users shell, -d home dir and -m to create the home dir. $4 is the password, $3 is the username. The other values passed to the shell script form php are used elsewhere in the shell script for setup of automatic account deletion.
I also moved the shell scripts and php script that calls the shell script to a directory outside of apache's local dir.
i.e. apache->php to collect new user info->pass info to php script outside of apache local dir->php script calls shell script also outside of apache local dir->shell script calls super prog->super references super.tab to see if the www user that apache/php is running as can run the referenced shell script (thus gaining root privs to execute the pw command and affect the accounts database)->pw is run with passed vaules->new local user with no shell env is created for ftp use only.