[tpm] Terminating SSH sessions

Alex Beamish talexb at gmail.com
Fri Aug 7 14:12:24 PDT 2009


On Fri, Aug 7, 2009 at 5:03 PM, <arocker at vex.net> wrote:
>
> What is the proper command to drop an SSH connection? The documentation is
> rather vague on the subject.
>
> I have a connection established with (essentially):
>
> $ssh = Net::SSH:Perl->new('remote.machine_id', protocol => '2' &c);
> $ssh->login("valid_id");
>
> Trying to hang up with:
>
> ($stdout, $stderr, $rc) = $ssh->cmd("disconnect");
>
> produces a return code of 127, and an "disconnect: command not found"
> error message from bash in $stderr
>
> Changing "disconnect" to "exit" produces a nice clean hang up.

Alternatively, just let the $ssh variable fall out of scope, and
Net::SSH::Perl should just Do The Right Thing and close the
connection.

-- 
Alex Beamish
Toronto, Ontario
aka talexb


More information about the toronto-pm mailing list