Re: [PHP] setting up FTP account names via PHP

2009-01-06 Thread Nathan Rixham

Ashley Sheridan wrote:

On Mon, 2009-01-05 at 16:16 +0100, Merlin Morgenstern wrote:
Is there a good FTP Daemon that can be recommended for this purpose? 
pure-ftpd seams out of development since 2006.




Jason Pruim wrote:

On 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
japr...@raoset.com
616.399.2355





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.uk



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 package

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] setting up FTP account names via PHP

2009-01-06 Thread Ashley Sheridan
On Mon, 2009-01-05 at 16:16 +0100, Merlin Morgenstern wrote:
> Is there a good FTP Daemon that can be recommended for this purpose? 
> pure-ftpd seams out of development since 2006.
> 
> 
> 
> Jason Pruim wrote:
> > 
> > On 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
> > japr...@raoset.com
> > 616.399.2355
> > 
> > 
> > 
> > 
> 
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.uk


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] setting up FTP account names via PHP

2009-01-05 Thread bruce
are you moving the files from the ftpdir, to a separate dir?

if you are, you can run your cron process from the top level dir... get a
list of any underlying files, and then iterate through the list to copy the
files to whereever you need to copy them...

you'd use the 'ls -R...' or the 'find' cmd for what you're looking to
do...



-Original Message-
From: Merlin Morgenstern [mailto:merli...@fastmail.fm]
Sent: Monday, January 05, 2009 3:56 PM
To: php-general@lists.php.net
Subject: Re: [PHP] setting up FTP account names via PHP


Hello everybody,

thank you all for your help. I got a solution running. In pure-ftpd you
can authenticate via mysql. Via a user table, exactly the thing I was
searching for.

However, there is a problem araising. Every user get's his own directory
for uploads. My next step would have been to create a php script which
will be run by cron every 5 minutes that scans one dir and if there is
content inside import it into the mysql db.
With the current setup I would need to scan all dirs to see if there are
changes inside.

Is there some kind of command where I could find out if there are new
files inside those folders? I don't see any other solution.

Any suggestions?

Thank you for any help,

merlin

bruce schrieb:
> merlin..
>
> if you're going to allow a user to use the same user/passwd for the site,
> and the FTP server.. i would strongly argue that you should allow the user
> only the minimal access on the FTP server. if someone hacks your site, no
> need to have them running rampant over your FTP server.
>
> i would actually argue that you can have the same username, but separate
> passwds, but i don'w know exactly what you're going to have on the FTP
> server, nor do I know your skill at securing servers/services...
>
> it doesn't really make a difference if you have separate dbs for the
> user/passwd auth systems. if you secure the overall system, it's secure.
if
> you don't, well you're going to run into issues..
>
> you might also look into existing web based mgmt apps for FTP servers to
see
> if any already exist.
>
>
>
> -Original Message-
> From: Merlin Morgenstern [mailto:merli...@fastmail.fm]
> Sent: Monday, January 05, 2009 6:56 AM
> To: php-general@lists.php.net
> Subject: Re: [PHP] setting up FTP account names via PHP
>
>
> 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?
>
> bruce wrote:
>> are you trying to allow a user who logs in, to use his same username when
>> interfacing with the FTP server?
>>
>> obviously, the password for the FTP server will be different. Or are you
>> looking to dynamically create a one time user/passwd for the user so that
> it
>> changes each time they access the FTP server?
>>
>>
>> -Original Message-
>> From: Merlin Morgenstern [mailto:merli...@fastmail.fm]
>> Sent: Monday, January 05, 2009 6:44 AM
>> To: php-general@lists.php.net
>> Subject: Re: [PHP] setting up FTP account names via PHP
>>
>>
>> Marc Steinert wrote:
>>> Merlin Morgenstern schrieb:
>>>> Hello everybody,
>>>>
>>>> I am running a real estate site where I would like to enable bulk
>>>> upload via real estate software that exports an xml file into an ftp
>>>> account.
>>>>
>>>> In order to give every user unique access I would need to generate
>>>> individual ftp name and passwords for each member. I can not see how
>>>> this should work. My portal is written in PHP 4.x and there every
>>>> members loges in with a unique ID. The FTP Server runns on the same
>>>> linux machine. How could I generate users for this FTP server with
>>>> php, for example on sign up?
>>>>
>>>> Thank you for any help on this.
>>>>
>>>> Best regards,
>>>>
>>>> Merlin
>>>>
>>> What ftp server are you using?
>>>
>> I just installed pureftpd. One possible sollution as I figured is to
>> alter the virtual user table of the ftp server with php.
>>
>> Is this the way to go, or does somebody have a better idea that saves
>> dev. time?
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] setting up FTP account names via PHP

2009-01-05 Thread Merlin Morgenstern

Hello everybody,

thank you all for your help. I got a solution running. In pure-ftpd you 
can authenticate via mysql. Via a user table, exactly the thing I was 
searching for.


However, there is a problem araising. Every user get's his own directory 
for uploads. My next step would have been to create a php script which 
will be run by cron every 5 minutes that scans one dir and if there is 
content inside import it into the mysql db.
With the current setup I would need to scan all dirs to see if there are 
changes inside.


Is there some kind of command where I could find out if there are new 
files inside those folders? I don't see any other solution.


Any suggestions?

Thank you for any help,

merlin

bruce schrieb:

merlin..

if you're going to allow a user to use the same user/passwd for the site,
and the FTP server.. i would strongly argue that you should allow the user
only the minimal access on the FTP server. if someone hacks your site, no
need to have them running rampant over your FTP server.

i would actually argue that you can have the same username, but separate
passwds, but i don'w know exactly what you're going to have on the FTP
server, nor do I know your skill at securing servers/services...

it doesn't really make a difference if you have separate dbs for the
user/passwd auth systems. if you secure the overall system, it's secure. if
you don't, well you're going to run into issues..

you might also look into existing web based mgmt apps for FTP servers to see
if any already exist.



-Original Message-
From: Merlin Morgenstern [mailto:merli...@fastmail.fm]
Sent: Monday, January 05, 2009 6:56 AM
To: php-general@lists.php.net
Subject: Re: [PHP] setting up FTP account names via PHP


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?

bruce wrote:

are you trying to allow a user who logs in, to use his same username when
interfacing with the FTP server?

obviously, the password for the FTP server will be different. Or are you
looking to dynamically create a one time user/passwd for the user so that

it

changes each time they access the FTP server?


-Original Message-
From: Merlin Morgenstern [mailto:merli...@fastmail.fm]
Sent: Monday, January 05, 2009 6:44 AM
To: php-general@lists.php.net
Subject: Re: [PHP] setting up FTP account names via PHP


Marc Steinert wrote:

Merlin Morgenstern schrieb:

Hello everybody,

I am running a real estate site where I would like to enable bulk
upload via real estate software that exports an xml file into an ftp
account.

In order to give every user unique access I would need to generate
individual ftp name and passwords for each member. I can not see how
this should work. My portal is written in PHP 4.x and there every
members loges in with a unique ID. The FTP Server runns on the same
linux machine. How could I generate users for this FTP server with
php, for example on sign up?

Thank you for any help on this.

Best regards,

Merlin


What ftp server are you using?


I just installed pureftpd. One possible sollution as I figured is to
alter the virtual user table of the ftp server with php.

Is this the way to go, or does somebody have a better idea that saves
dev. time?


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] setting up FTP account names via PHP

2009-01-05 Thread Sancar Saran
On Monday 05 January 2009 16:29:09 Merlin Morgenstern wrote:
> Hello everybody,
>
> I am running a real estate site where I would like to enable bulk upload
> via real estate software that exports an xml file into an ftp account.
>
> In order to give every user unique access I would need to generate
> individual ftp name and passwords for each member. I can not see how
> this should work. My portal is written in PHP 4.x and there every
> members loges in with a unique ID. The FTP Server runns on the same
> linux machine. How could I generate users for this FTP server with php,
> for example on sign up?
>
> Thank you for any help on this.
>
> Best regards,
>
> Merlin

If those xml files not that big, you may consider uploading with php.

Or perhaps you may find an ftp server which can use mysql database for 
authentication.


RE: [PHP] setting up FTP account names via PHP

2009-01-05 Thread bruce
merlin..

if you're going to allow a user to use the same user/passwd for the site,
and the FTP server.. i would strongly argue that you should allow the user
only the minimal access on the FTP server. if someone hacks your site, no
need to have them running rampant over your FTP server.

i would actually argue that you can have the same username, but separate
passwds, but i don'w know exactly what you're going to have on the FTP
server, nor do I know your skill at securing servers/services...

it doesn't really make a difference if you have separate dbs for the
user/passwd auth systems. if you secure the overall system, it's secure. if
you don't, well you're going to run into issues..

you might also look into existing web based mgmt apps for FTP servers to see
if any already exist.



-Original Message-
From: Merlin Morgenstern [mailto:merli...@fastmail.fm]
Sent: Monday, January 05, 2009 6:56 AM
To: php-general@lists.php.net
Subject: Re: [PHP] setting up FTP account names via PHP


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?

bruce wrote:
> are you trying to allow a user who logs in, to use his same username when
> interfacing with the FTP server?
>
> obviously, the password for the FTP server will be different. Or are you
> looking to dynamically create a one time user/passwd for the user so that
it
> changes each time they access the FTP server?
>
>
> -Original Message-
> From: Merlin Morgenstern [mailto:merli...@fastmail.fm]
> Sent: Monday, January 05, 2009 6:44 AM
> To: php-general@lists.php.net
> Subject: Re: [PHP] setting up FTP account names via PHP
>
>
> Marc Steinert wrote:
>> Merlin Morgenstern schrieb:
>>> Hello everybody,
>>>
>>> I am running a real estate site where I would like to enable bulk
>>> upload via real estate software that exports an xml file into an ftp
>>> account.
>>>
>>> In order to give every user unique access I would need to generate
>>> individual ftp name and passwords for each member. I can not see how
>>> this should work. My portal is written in PHP 4.x and there every
>>> members loges in with a unique ID. The FTP Server runns on the same
>>> linux machine. How could I generate users for this FTP server with
>>> php, for example on sign up?
>>>
>>> Thank you for any help on this.
>>>
>>> Best regards,
>>>
>>> Merlin
>>>
>> What ftp server are you using?
>>
>
> I just installed pureftpd. One possible sollution as I figured is to
> alter the virtual user table of the ftp server with php.
>
> Is this the way to go, or does somebody have a better idea that saves
> dev. time?
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] setting up FTP account names via PHP

2009-01-05 Thread Phpster

What about just using an http upload?

Bastien

Sent from my iPod

On 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?


bruce wrote:
are you trying to allow a user who logs in, to use his same  
username when

interfacing with the FTP server?
obviously, the password for the FTP server will be different. Or  
are you
looking to dynamically create a one time user/passwd for the user  
so that it

changes each time they access the FTP server?
-Original Message-
From: Merlin Morgenstern [mailto:merli...@fastmail.fm]
Sent: Monday, January 05, 2009 6:44 AM
To: php-general@lists.php.net
Subject: Re: [PHP] setting up FTP account names via PHP
Marc Steinert wrote:

Merlin Morgenstern schrieb:

Hello everybody,

I am running a real estate site where I would like to enable bulk
upload via real estate software that exports an xml file into an  
ftp

account.

In order to give every user unique access I would need to generate
individual ftp name and passwords for each member. I can not see  
how

this should work. My portal is written in PHP 4.x and there every
members loges in with a unique ID. The FTP Server runns on the same
linux machine. How could I generate users for this FTP server with
php, for example on sign up?

Thank you for any help on this.

Best regards,

Merlin


What ftp server are you using?


I just installed pureftpd. One possible sollution as I figured is to
alter the virtual user table of the ftp server with php.
Is this the way to go, or does somebody have a better idea that saves
dev. time?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] setting up FTP account names via PHP

2009-01-05 Thread Merlin Morgenstern
Is there a good FTP Daemon that can be recommended for this purpose? 
pure-ftpd seams out of development since 2006.




Jason Pruim wrote:


On 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
japr...@raoset.com
616.399.2355






--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] setting up FTP account names via PHP

2009-01-05 Thread Jason Pruim


On 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
japr...@raoset.com
616.399.2355





Re: [PHP] setting up FTP account names via PHP

2009-01-05 Thread Merlin Morgenstern
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?


bruce wrote:

are you trying to allow a user who logs in, to use his same username when
interfacing with the FTP server?

obviously, the password for the FTP server will be different. Or are you
looking to dynamically create a one time user/passwd for the user so that it
changes each time they access the FTP server?


-Original Message-
From: Merlin Morgenstern [mailto:merli...@fastmail.fm]
Sent: Monday, January 05, 2009 6:44 AM
To: php-general@lists.php.net
Subject: Re: [PHP] setting up FTP account names via PHP


Marc Steinert wrote:

Merlin Morgenstern schrieb:

Hello everybody,

I am running a real estate site where I would like to enable bulk
upload via real estate software that exports an xml file into an ftp
account.

In order to give every user unique access I would need to generate
individual ftp name and passwords for each member. I can not see how
this should work. My portal is written in PHP 4.x and there every
members loges in with a unique ID. The FTP Server runns on the same
linux machine. How could I generate users for this FTP server with
php, for example on sign up?

Thank you for any help on this.

Best regards,

Merlin


What ftp server are you using?



I just installed pureftpd. One possible sollution as I figured is to
alter the virtual user table of the ftp server with php.

Is this the way to go, or does somebody have a better idea that saves
dev. time?


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] setting up FTP account names via PHP

2009-01-05 Thread bruce
are you trying to allow a user who logs in, to use his same username when
interfacing with the FTP server?

obviously, the password for the FTP server will be different. Or are you
looking to dynamically create a one time user/passwd for the user so that it
changes each time they access the FTP server?


-Original Message-
From: Merlin Morgenstern [mailto:merli...@fastmail.fm]
Sent: Monday, January 05, 2009 6:44 AM
To: php-general@lists.php.net
Subject: Re: [PHP] setting up FTP account names via PHP


Marc Steinert wrote:
> Merlin Morgenstern schrieb:
>> Hello everybody,
>>
>> I am running a real estate site where I would like to enable bulk
>> upload via real estate software that exports an xml file into an ftp
>> account.
>>
>> In order to give every user unique access I would need to generate
>> individual ftp name and passwords for each member. I can not see how
>> this should work. My portal is written in PHP 4.x and there every
>> members loges in with a unique ID. The FTP Server runns on the same
>> linux machine. How could I generate users for this FTP server with
>> php, for example on sign up?
>>
>> Thank you for any help on this.
>>
>> Best regards,
>>
>> Merlin
>>
> What ftp server are you using?
>

I just installed pureftpd. One possible sollution as I figured is to
alter the virtual user table of the ftp server with php.

Is this the way to go, or does somebody have a better idea that saves
dev. time?


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] setting up FTP account names via PHP

2009-01-05 Thread Merlin Morgenstern

Marc Steinert wrote:

Merlin Morgenstern schrieb:

Hello everybody,

I am running a real estate site where I would like to enable bulk 
upload via real estate software that exports an xml file into an ftp 
account.


In order to give every user unique access I would need to generate 
individual ftp name and passwords for each member. I can not see how 
this should work. My portal is written in PHP 4.x and there every 
members loges in with a unique ID. The FTP Server runns on the same 
linux machine. How could I generate users for this FTP server with 
php, for example on sign up?


Thank you for any help on this.

Best regards,

Merlin


What ftp server are you using?



I just installed pureftpd. One possible sollution as I figured is to 
alter the virtual user table of the ftp server with php.


Is this the way to go, or does somebody have a better idea that saves 
dev. time?



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] setting up FTP account names via PHP

2009-01-05 Thread Marc Steinert

Merlin Morgenstern schrieb:

Hello everybody,

I am running a real estate site where I would like to enable bulk 
upload via real estate software that exports an xml file into an ftp 
account.


In order to give every user unique access I would need to generate 
individual ftp name and passwords for each member. I can not see how 
this should work. My portal is written in PHP 4.x and there every 
members loges in with a unique ID. The FTP Server runns on the same 
linux machine. How could I generate users for this FTP server with 
php, for example on sign up?


Thank you for any help on this.

Best regards,

Merlin


What ftp server are you using?

--
http://bithub.net/
Synchronize and share your files over the web for free


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php