RE: [PHP] How to change process permissions?
| From: | Don Read | Date: | Sat, 23 Jun 2001 03:44:40 +0000 |
| Subject: | RE: [PHP] How to change process permissions? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-54952@lists.php.net to get a copy of this message | ||
On 22-Jun-01 Nick wrote:
>
> I writing a web based admin panel for myself for my site. My PHP script
> needs to be able to read, write, and move files around. The way I'm
> currently getting it to work is by making a directory owned by "nobody" with
> all permissions set so the script can write files there. Any file that is
> created by the script also turns out to be owned by "nobody". This is ok,
> except that don't want to have a directory owned by nobody which has all
> permissions set, and I want to be able to overwrite files logged in as
> myself without su'ing and chown'ing everything first.
Run your sever as root & use posix_setuid() --a stunningly Bad Idea(tm).
> Is there a way like
> there is in PERL to change the account the script runs as?
Perl can't (or shouldn't) do it either. SUID Perl is evil.
Web-admin controls can have nasty dragons lurking about.
If you absolutely _must_ have it; let the PHP/CGI scripts modify copies
of the files.
Then run a small shell script to move 'em into place after root has
eyeball'd them.
Regards,
--
Don Read dread@texas.net
-- It's always darkest before the dawn. So if you are going to
steal the neighbor's newspaper, that's the time to do it.