Re: Exec as user
| From: | Mike Eheler | Date: | Thu, 27 Dec 2001 21:16:02 +0000 |
| Subject: | Re: Exec as user | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-78874@lists.php.net to get a copy of this message | ||
There's no way that I have found to actually execute a script as a specified user, however:
<?php
passthru('whoami');
?>
Should tell you what user the web server is running as.
Mike
Charlesk wrote:
I have been looking through the docs and found no help on either finding which user the EXEC'ed commands run as, or how to specify which user they should run as. I tried exec, system, and passthru running a batch file that would write %USERNAME% to a file. And all three functions wrote nothing. They would however write "hello world". Has anybody else run into this. I tried exec("test.bat"); test.bat: echo %USERNAME% > test.txt when run from a command line it resulting in "Charles" when run from a webpage it resulted in "ECHO is on." if I added a line "echo off" above the echo username it resulted in "ECHO is off." again only from the webpage. In essense I need to update a DNS server through a web page. It works if the script is local but not if it has to update a different server. Charles Killmer Windows 2000 Server, IIS 5.0, PHP 4.1.0