shivangi has asked for the wisdom of the Perl Monks concerning the following question:

Hello, Is there any method in Net::OpenSSH through which we can opens up an interactive shell on the remote machine and connects it to our STDIN ???? Just like Net::SSH::Perl's $ssh->shell() method.

  • Comment on Connect remote shell to local machine STDIN

Replies are listed 'Best First'.
Re: Connect remote shell to local machine STDIN
by salva (Canon) on Nov 29, 2013 at 08:28 UTC
    Just don't pass any command to Net::OpenSSH methods and it will run the shell. You may also like to request a tty on the remote side using tty => 1.

    For instance, running the shell attached to the local stdio:

    $ssh->system;

    Attaching it to a socket:

    my $socket = $ssh->open2socket

    Or to a pseudo tty:

    my $pty = $ssh->open2pty

    Another way to do it is to explicitly specify the shell command you want to run:

    my $socket = $ssh->open2socket('/usr/sh', '-i');
      yeyyy!!!! IT WORKED .... Thanks Salva :)