Re: Execute (OS) commands that need rights
| From: | Stig S. Bakken | Date: | Fri, 01 Mar 2002 08:02:38 +0000 |
| Subject: | Re: Execute (OS) commands that need rights | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-922@lists.php.net to get a copy of this message | ||
On Thu, 2002-02-28 at 13:13, Ralph Beekman wrote:
> I protected a web on a Cobalt RaQ4 using .htaccess. The command to add users
> or change passwords is
> >htpasswd [-b] <passwordfile .htaccess> <username> [<password>]
> (-b is used if <password> is given in the command, otherwise password will
> be prompted twice)
>
> I want my webusers to be able to change their password themselves using a
> page that passes un/pw to PHP.
> The htpasswd command needs priveledges. So this doesn't work now (using
> passthru() or exec()).
>
> How can I safely see to it that the priviledges needed for this command are
> set in the PHP code?
>
> Note. I am a novice at PHP
Either you have to chown the users file to the same user running Apache,
or you can for example use "sudo" to let the Apache user execute just
that command as some other user.
- Stig