Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

running remote server program

Status
Not open for further replies.

xiaoleiqq

Programmer
Aug 30, 2006
43
US
Hi all,

I have a web script (located in a web server) that wants to launch the program on another server(data server on the same network). I use Net::SSH::perl module from CPAN, and it works if I log in to the web server and running the web script from there and fail to launch the program from a web interface.

Can any one gives hints on what might be the problem?

Thanks very much...
 
xiaolieqq,
the web server runs under a different set of credentials than a console user.

Have you any error messages in your webserver log that might help?

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Hi,

The error I get is

sh: line 1: 10:43:38,Fri,Oct,6,2006: command not found
mkdir /.ssh: Permission denied at /usr/lib/perl5/site_perl/5.8.5/Net/SSH/Perl/Util/Hosts.pm line 51

no matter what my command is, even I try the simplest "ls" command, here is the sample code.
my $host = "host1";
my $ssh = Net::SSH::perl->new($host1);
my $user = "user1";
my $pass = "pass1";
$ssh->login($user, $pass);
my ($stdout, $stderr, $exit) = $ssh->cmd("ls");
 
have you tried logging on to the host with that username and password, it could be a restricted shell, so none of the commands will be available


looks like it's making the connection, but there could be some policies about remote logins or something else in force to prevent this from occurring

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
With that error message I suspect that your webserver user
a) has no home directory (hence the default /)
b) isn't root, so can't create /.ssh as an ssh configuration file container as / is almost always only writable to by root.

The script is also trying to execute a strange comma-separated date too; I can offer no particular insight here as I've not seen anything give dates quite like that as a standard output.

A good first step would be to assign your webserver user a home directory it can write to.
 
Thanks for the input,

I am not the system administrator so I guess my approach of using the web to launch program on different server won't work at all?
 
it canm be set up to use SSH, using keys rather than passwords, don't have time right now to dig up a tutorial on it, but I'll be back at some stage tomorrow


Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Also,
I get this message when I running my program on the web server,

Argument "ssh-rsa" isn't numeric in numeric eq (==) at /usr/lib/perl5/site_perl/5.8.5/Net/SSH/Perl/Key/RSA1.pm line 94, <FH> line 10.

not sure how to fix that problem, thanks for any input.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top