SSH with X11 forwarding in Perl -


i have tried perl modules net::ssh:perl , net::openssh no avail. x11 forwarding work because if "ssh root@host" , execute x application such "xterm" window back.

here things i've tried:

    $self->{'ssh'} = net::openssh->new("root:pw@".$hostname);     print $self->{'ssh'}->capture("env"); #the display variable not set won't work     print $self->{'ssh'}->capture("xterm"); 

nope

    $self->{'ssh'} = net::openssh->new("root:pw@".$hostname, master_opts => ['-x' => '']);     print $self->{'ssh'}->capture("env"); #the display variable not set won't work     print $self->{'ssh'}->capture("xterm"); #nope     print $self->{'ssh'}->capture({master_opts => ['-x']}, "xterm"); #nope 

nope, net::ssh::perl

    $self->{'ssh'} = net::ssh::perl->new("$hostname", debug=>0);     $self->{'ssh'}->login("root","pass");     ($stdout, $stderr, $exit) = $self->{'ssh'}->cmd("xterm"); #nope 

nope

    $self->{'ssh'} = net::ssh::perl->new("$hostname", debug=>0, options=>["forwardx11 yes"]);     $self->{'ssh'}->login("root","pass");     ($stdout, $stderr, $exit) = $self->{'ssh'}->cmd("xterm"); #nope 

the thing works if following, know x11 forwarding working in perl.

    `ssh root@host xterm` 

i rather modules working if possible if can somehow open bidirectional pipe, communicate ssh , receive data when want (similar how can $self->{'ssh'}->cmd() , receive output @ time in script), that. don't know start. else did before?

the development version of net::openssh has new option forward_x11. seems work:

my $ssh = net::openssh->new("localhost", forward_x11 => 1); print $ssh->capture({forward_x11 => 1}, "env"); # includes display=localhost... print $ssh->capture({forward_x11 => 1}, "xclock"); # starts xclock program 

note have specify new option on both constructor , actual command.

see http://www.perlmonks.org/?node_id=1028837


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -