Jump to content

system(); command not working on remote system. Windows.


thephpguy

Recommended Posts

This is my set up:

My server is a windows machine, on the same domain as python(also a windows machine).

Apache is running as a service as an administrator.

This is a test only environment to whom it may concern(I hate people telling me how insecure my system is)

 

I'm just trying to run:

 

$last_line = exec('dir \\python\c$', $retval, $g);
print_r($retval);
echo '<br>'.$g.'<br>';
echo '$last_line= '.$last_line.'<br>';

 

Which outputs:

 

Array ( )
1
$last_line=

 

The command from the command line works fine. And apache can access directories that only administrators can access on the local machine.

 

What's wrong???

 

Thanks in advance!

 

 

-Tim

Correction to myself, typically apache runs under user system, when doing a echo %username% in the cmd line this will echo the computers name instead of the username system.

Right now when I do an "echo %username%" it echos the administrators user account username.(which is correct)

 

Also just to doubly prove that the apache service is running as the admin, when looking in the task manager HTTPD.exe(both of them) is running under the admin account.

 

I will add the group is N/A.

 

also trying to run psexec gives me

 

Array ( )

1326

$last_line=

 

 

Apache version = 2.2.4

PHP version = 5.2.1

Ok I think I got part of it figured out. It is indeed a permissions issue....

 

 

$command="psexec "; \\removed command for my privacy
$output=shell_exec($command." 2>&1");  //system call
print "<pre>$output</pre>\n";          //show output

 

outputs

 

PsExec v1.71 - Execute processes remotely

Copyright © 2001-2006 Mark Russinovich

Sysinternals - www.sysinternals.com

 

Logon failure: unknown user name or bad password.

 

PsExec could not start \server_name:

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.