Re: Automate FTP account creation
- From: The Natural Philosopher <tnp@xxxxxxxxxxxxxxx>
- Date: Thu, 23 Apr 2009 14:57:06 +0100
Mitul wrote:
On Apr 23, 4:47 pm, Jerry Stuckle <jstuck...@xxxxxxxxxxxxx> wrote:Mitul wrote:Hello Friends,You're not going to be able to do this easily. FTP accounts will
I am running into one problem. I need help...I am stuck at this
point.... Please check below:
I am building LAMP based site. I want to create FTP account for
register user. i.e when user register to website then an FTP account
will be created for that user. so that user can upload large file
using FTP.
I need to automate this task so that an FTP account created for user.
Please help me out in this.
Thanks,
Mitul Patel.
require you create a UNIX account for the user, which will require root
access. And you do NOT want to give this access to the web server! And
you'll need to have a dedicated server (or VPS) as shared hosting will
not give you root access.
You could do it by executing a PHP script which switches to the root
user and adds the new account by executing the appropriate system
commands. But I would suggest a shell script would be better suited for
this task. I'd recommend checking the Linux support forums.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@xxxxxxxxxxxxx
==================
Thanks Jerry,
My hosting is on dedicated server.
I already have shell script but problem is that to create user command
must be executed via root user. Now the problem is how to switch to
root user using PHP or shell script. Coz when PHP script execute Shell
script which in term apache user call that shell script so it does not
create user account on unix. Can you help me out how to switch to root
user? or any good forum or group that help me out in this problem? I
have look around a lot on internet but could not find any solution.
Any help would be appreciated.
Thanks,
Mitul Patel.
Its not necessary that ANY ftp daemon check against the *nix password/user/group structure and obviously you can use anonymous.
This is a question that falls between all the possible groups, depending on exactly what you want to achieve.
If you are happy to add users and groups then its no big deal to write a program or IIRC a script, with setuid permissions that has root permissions when called by a non root program.
See here
http://en.wikipedia.org/wiki/Setuid
So essentially you may be able to make an 'adduser' program if its written in C have superuser rights to do what's needed. Scripts probably not..you have to write a minimal C program to execute the script - I think that's how we did it anyway.
So that's one approach.
Another is to get an FTP daemon that doesn't refer to the password file for authentication, or patch one that does..Now the issue you then run into is what UID/GID to give the uploaded files.
The company I am developing some custom software for had this issue with ftp. In the end I developed a system that allows users to be constructed inside a php/MySQL suite, and php also nmodifies .htpasswd files which it can write to, as further authentication, and then use that level of authorisation to allow and control access to a part of the database that is used as a file upload repository.
The users like it, because its all web browser, and they can see what they have uploaded and so on, and we like it because its got security to the level WE want it, and we can see any uploads on a per project per users basis, and pull the data out of the database as and when needed. And, best of all, its a snap to backup the data - its all in the database. Where it cannot be accessed and deleted, because the access methods given do not permit it.
You might consider a mixture of approaches, and write - possibly in PHP - an ftp daemon that uses a database with users and files inside it. The FTP protocol is not rocket science and is fairly easy to emulate.
.
- References:
- Automate FTP account creation
- From: Mitul
- Re: Automate FTP account creation
- From: Jerry Stuckle
- Re: Automate FTP account creation
- From: Mitul
- Automate FTP account creation
- Prev by Date: Re: Automate FTP account creation
- Next by Date: Re: HTTP Authentication with PHP
- Previous by thread: Re: Automate FTP account creation
- Next by thread: Re: Automate FTP account creation
- Index(es):
Relevant Pages
|