Welcome to MobyThreads.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in
All support for the MobyThreads Threaded phpBB MOD can now be found on welsolutions at this forum

cron adduser

 
   Web Hosting and Web Master Forums (Home) -> Apache RSS
Next:  load balance resources  
Author Message
Séverin_Richard

External


Since: Jul 30, 2007
Posts: 8



(Msg. 1) Posted: Thu Aug 23, 2007 12:02 pm
Post subject: cron adduser
Archived from groups: alt>apache>configuration (more info?)

Hi,

creating a .php containing
<? exec( "useradd myuser" ) ?>

and called by cron as root does not create a user.


What can i change to make it work??

thx for idears.

 >> Stay informed about: cron adduser 
Back to top
Login to vote
phantom

External


Since: Aug 23, 2007
Posts: 21



(Msg. 2) Posted: Thu Aug 23, 2007 12:02 pm
Post subject: Re: cron adduser [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Séverin Richard" <severin.richard.RemoveThis@free.fr> wrote in message
news:46cd9980$0$416$426a74cc@news.free.fr...
> Hi,
>
> creating a .php containing
> <? exec( "useradd myuser" ) ?>
>
> and called by cron as root does not create a user.

If it didn't work, then surely you'll have some errors - cron output
generally gets emailed somewhere (and this output will probably tell you why
it didn't work)

> What can i change to make it work??

you'll probably find that cron doesn't have the same path as your logged in
user and you'll need to do:
<?php exec("/usr/sbin/useradd myuser"); ?>

 >> Stay informed about: cron adduser 
Back to top
Login to vote
patpro ~ Patrick Proniews

External


Since: May 30, 2005
Posts: 30



(Msg. 3) Posted: Thu Aug 23, 2007 4:39 pm
Post subject: Re: cron adduser [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <46cd9980$0$416$426a74cc@news.free.fr>,
Séverin Richard <severin.richard RemoveThis @free.fr> wrote:

> Hi,
>
> creating a .php containing
> <? exec( "useradd myuser" ) ?>
>
> and called by cron as root does not create a user.
>
>
> What can i change to make it work??

wouaaaa.
That's looks like the worst idea ever to me.
I see 3 problems here :

you should not allow php to run exec.
you can't call a command requiring root privileges from apache
if you want to create users automatically, you must keep everything out
of reach of remote users.

I don't know what brainstorming yielded to your cron/php thing, but be
sure it's a very bad idea.

patpro

--
http://www.patpro.net/
 >> Stay informed about: cron adduser 
Back to top
Login to vote
Séverin_Richard

External


Since: Jul 30, 2007
Posts: 8



(Msg. 4) Posted: Thu Aug 23, 2007 4:48 pm
Post subject: Re: cron adduser [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

FIRST:
root privilege do not allow users to call the php script:
http://themachine/thesecretpass/myphpEXEC.php
returns "NOT ALLOWED gid unsificient..etc"...

SECOND:
the phpscript makes a database query and implements users that had
allready suscribe the site, and are waiting for confimation.

No other user may be added here.
all Strings concerning users are escaped with all no alphanumeric
characteres.
$secureSTR = ereg( "[^0-9a-zA-Z]","", rowsquerySrt );


THIRD:
I have to create user dynamicaly...

>>creating a .php containing
>><? exec( "useradd myuser" ) ?>
>>
>>and called by cron as root does not create a user.
>>
>>
>>What can i change to make it work??



Who can help??





patpro ~ Patrick Proniewski wrote:
> In article <46cd9980$0$416$426a74cc@news.free.fr>,
> Séverin Richard <severin.richard.DeleteThis@free.fr> wrote:
>
>
>>Hi,
>>
>>creating a .php containing
>><? exec( "useradd myuser" ) ?>
>>
>>and called by cron as root does not create a user.
>>
>>
>>What can i change to make it work??
>
>
> wouaaaa.
> That's looks like the worst idea ever to me.
> I see 3 problems here :
>
> you should not allow php to run exec.
> you can't call a command requiring root privileges from apache
> if you want to create users automatically, you must keep everything out
> of reach of remote users.
>
> I don't know what brainstorming yielded to your cron/php thing, but be
> sure it's a very bad idea.
>
> patpro
>
 >> Stay informed about: cron adduser 
Back to top
Login to vote
MonTassaR

External


Since: Aug 06, 2007
Posts: 3



(Msg. 5) Posted: Fri Aug 24, 2007 11:00 am
Post subject: Re: cron adduser [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Aug 23, 4:28 pm, Séverin Richard <severin.rich... RemoveThis @free.fr> wrote:
> Hi,
>
> creating a .php containing
> <? exec( "useradd myuser" ) ?>
>
> and called by cron as root does not create a user.
>
> What can i change to make it work??
>
> thx for idears.

Instead of creating system users dynamically that way, I would :

1- replace your php file with an other one that simply writes the
username I want to create in a temporary text file thata remotely
called php script can access ..
2- add a cron that periodically runs a shell script as root that,
checks wheter the temporary file contain some users to add, add users
if ever there are users to add and empty the file/comment the line
containing the user that's bee already added ..

This seems to me much more clean than using php exec() ...
 >> Stay informed about: cron adduser 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
rotateing logs on demand / from cron - Maybe I just reinvented the wheel, but I couldn't find an easy way to do this. All I wanted to do was rotate my apache logs at midnight Sunday, so I could have weekly logs. If it's of any use to anyone else I have put my patch here:..
   Web Hosting and Web Master Forums (Home) -> Apache All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]