mikihasa has asked for the wisdom of the Perl Monks concerning the following question:
here is the script (i know there are easier ways to get directory listings, but this is just a sublime example of what i am really trying to accomplish):
when run from the shell (as the web server user), it works great (a.k.a. i get a directory listing) but when run via the web browser it says it is going to run the command but i get no output#!/usr/bin/perl use Net::SSH::Perl; use strict; print(qq(Content-Type: text/html\n\n)); print(qq(<HTML><HEAD><TITLE>Remote Test</TITLE></HEAD><BODY>)); &list_directory(); print(qq(</BODY></HTML>)); exit; sub list_directory { my(%ssh_params) = ( 'port' => '40001', ); my($hostname) = '12.345.67.890'; my($ssh_username) = 'root'; my($ssh_password) = 'noneya'; my($command) = qq(ls -l); print(qq(creating ssh connection<br>\n)); my($ssh) = Net::SSH::Perl->new($hostname), %ssh_params); print(qq(logging in<br>\n)); $ssh->login($ssh_username, $ssh_password); print(qq(running command: $command<br>\n)); my($stdout, $stderr, $exitval) = $ssh->cmd($command); print(qq(directory listing: $stdout<br>\n)); } 1;
i thought it might be something with the default port (22) not being accessible from the web, which is why i started sshd on another port (40001) and used the port option to access it that way, but still no luck
my guess is that it is a permissions issue (isn't it always?) but i am not sure how to ferret it out beyond what i have already done
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Net::SSH::Perl shell vs web
by jcpunk (Friar) on Jan 17, 2004 at 22:41 UTC | |
by mikihasa (Initiate) on Jan 17, 2004 at 23:53 UTC | |
by thor (Priest) on Jan 18, 2004 at 16:25 UTC | |
by Anonymous Monk on Jan 18, 2004 at 23:28 UTC | |
by Anonymous Monk on Jan 19, 2004 at 17:09 UTC | |
by Anonymous Monk on Jan 20, 2004 at 12:52 UTC |