I have had the same problem. I believe my solution was to just call another
script that did it for me. Also may want to try using ssh keys - you may need
to specify the path to to key though.
On Aug 12, 2013, at 12:34 AM, Николай Кинаш <peroksi...@gmail.com> wrote:
>
> Hello.
>
> How Mason worked with SSH modules ?
>
> I have 2 host.
>
> First, try:
>
> <%perl>
> use Net::SSH::Expect;
>
> $ENV{HOME} = "home/peroksid/data/www/novosibursk.ru/";
>
> my $ssh = Net::SSH::Expect->new(
> host => "europeancards.ru",
> password => "mypass",
> user => "root",
> raw_pty => 1,
> timeout => 5
> );
>
> my $login_output = $ssh->login();
> if ($login_output !~ /Welcome/) {
> die "Login has failed.
> Login output was $login_output";
> }
>
> my $ls = $ssh->exec("ls -la");
> print $ls;
> </%perl>
>
> But didn`t work. $ls; - empty in Web browser.
>
> Remoute host logged:
> %Aug 12 12:46:09 peroksid sshd[45543]: Accepted keyboard-interactive/pam for
> root from 149.154.64.15 port 21656 ssh2
> Aug 12 12:46:09 peroksid sshd[45543]: Received disconnect from 149.154.64.15:
> 11: disconnected by user
>
> Aug 12 12:46:09 -> 0 second -> Aug 12 12:46:09
>
>
> Then, try equal CGI-code:
> root@peroksid:/home/peroksid/data/www/novosibursk.ru #cat ssh.pl
> #!/usr/bin/perl
> use strict;
> use Net::SSH::Expect;
> print "Content-type: text/html\n\n";
>
> $ENV{HOME} = "home/peroksid/data/www/novosibursk.ru/";
>
> my $ssh = Net::SSH::Expect->new(
> host => "europeancards.ru",
> password => "mypass",
> user => "root",
> raw_pty => 1,
> timeout => 5
> );
> eval {
> my $login_output = $ssh->login();
> if ($login_output !~ /Welcome/) {
> die "Login has failed.
> Login output was $login_output";
> }
> };
> my $ls = $ssh->exec("ls -la");
> print $ls;
>
> It`s work:
> root@peroksid:/home/peroksid/data/www/novosibursk.ru # perl ssh.pl
> Content-type: text/html
>
> ls -la
> total 6
> drwx------ 3 root wheel 512 Aug 12 06:30 .
> drwxr-xr-x 26 root wheel 1024 Aug 12 06:00 ..
> drwx------ 2 root wheel 512 Aug 12 08:56 .ssh
>
> The same in Web browser.
>
> Remoute host logged:
> %Aug 12 12:49:00 peroksid sshd[45549]: Accepted keyboard-interactive/pam for
> root from 149.154.64.15 port 22606 ssh2
> Aug 12 12:49:10 peroksid sshd[45549]: Received disconnect from 149.154.64.15:
> 11: disconnected by user
>
> Aug 12 12:49:00 -> 10 second -> Aug 12 12:49:10
> ------------------------------------------------------------------------------
> Get 100% visibility into Java/.NET code with AppDynamics Lite!
> It's a free troubleshooting tool designed for production.
> Get down to code-level detail for bottlenecks, with <2% overhead.
> Download for free and get started troubleshooting in minutes.
> http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
> _______________________________________________
> Mason-users mailing list
> Mason-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mason-users
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users