system('rsh ...') not working

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jediboy
Forum Newbie
Posts: 2
Joined: Fri Mar 11, 2005 11:59 am

system('rsh ...') not working

Post by jediboy »

I'm running php4 with apache on windows and I'm trying to use system() with rsh commands to a linux box but i can't seem to get it to work. I've seen a few posts about attempting similar things and getting the same results that I am getting, but I have not come across any resolutions yet.

Here is the code I'm executing:

Code: Select all

<?php
echo '<pre>';
system('rsh host -l user command',$retval);
echo '</pre>
<hr>RC='.$retval;
?>
I get no output and my return code is 1. When I run this rsh command at a dos prompt it works fine. Also if i replace the command in the php code to something like 'dir' then that works and i get a directory listing. I just can't seem to get the rsh command to work. Any ideas?


feyd | Please use

Code: Select all

and

Code: Select all

tags where approriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
jediboy
Forum Newbie
Posts: 2
Joined: Fri Mar 11, 2005 11:59 am

Post by jediboy »

I finally figured it out .... i forgot that running from the php code the rsh command was being submitted by the apache user which explains why it worked from the command line because rsh was running with the windows user.

so to get it to work i needed to update my .rhosts file on the remote machine with the apache user. I'm assuming the return code of 1 I was getting was "permission denied".
Post Reply