NYCPHP Meetup

NYPHP.org

[nycphp-talk] Changing UNIX shadow passwords with PHP

leam at reuel.net leam at reuel.net
Wed Mar 16 18:10:12 EST 2005


Pardon the newbieness, but is there an expect like extension to php that would let you interact with the regular password program? 

ciao!

leam

On Tue, Mar 15, 2005 at 02:20:17PM -0500, Rolan Yang wrote:
> Look into sudo. You can sudo the "/usr/bin/passwd" file so that it can 
> be run as the user of your apache (probably "nobody" or "apache" or 
> "http"), then do a
> system("/usr/bin/passwd $user $password");
> in php. This method would make a sysadmin a bit nervous though.
> 
> Another safer way to go about it would be to append all password 
> requests to a designated file, in the format "username:password" then 
> create a root owned cron script which runs "/usr/sbin/chpasswd 
> <thefile>" every minute or so. You would want to employ some method of 
> file locking within the cron script and also the php script because if 
> the job runs while the php script is writing to the file, odd things can 
> happen.
> 
> ~Rolan
> 
> Atul Ohri wrote:
> 
> >Hey Everyone…
> >
> >I’ve been trying to figure out a simple yet secure way to allow user’s 
> >with mailboxes on any of our servers to change their passwords via the 
> >web. I have done extensive research on the web and haven’t found 
> >anything promising regarding doing this in PHP. It seems I may be able 
> >to accomplish it with a Perl script and then I could wrap that Perl 
> >script around a PHP interface but I’m not even sure that would work. 
> >The passwords are stored in a shadow passwd file format so however I 
> >accomplish this I would have to change to root to make changes to the 
> >/etc/shadow file. Would I have to use SUID to accomplish this? Does 
> >anyone know of any PHP scripts that could help me accomplish my goal? 
> >I’m sure someone somewhere has the need for a script like this… 
> >Naturally all of this would take place over a secure connection.
> >
> >So does anyone have any advice on how I can accomplish this in PHP?
> >
> >Atul
> >
> >------------------------------------------------------------------------
> >
> > 
> >
> _______________________________________________
> New York PHP Talk Mailing List
> AMP Technology
> Supporting Apache, MySQL and PHP
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.nyphp.org
> 
> 



More information about the talk mailing list