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

Can anyone tell me how to securely connect to a remote host using ssh and telnet and execute applications on these remote computers using Perl. Is it at all possible to execute the system() function from within a script and run remote applications. Thanks.

Replies are listed 'Best First'.
Re: ssh and telnet
by btrott (Parson) on Jan 26, 2001 at 03:28 UTC
    There's a Net::Telnet module you can use. It implements a telnet client in Perl.

    I'm writing an ssh client, Net::SSH, which isn't yet on CPAN but should be soon at some point. You can read more about it here.

    Update: Petruchio mentioned that I should give some details on why you might want to use my Net::SSH module rather than the one already on CPAN. Here it is: mine is an all-Perl ssh client, and the one on CPAN is simply a wrapper around the ssh executable. Now there are advantages and disadvantages to both, but I find that the disadvantage of forking a process etc., when using the Net::SSH on CPAN, is a very big disadvantage. And that's why I think my module is good, useful, etc.

Re: ssh and telnet
by Lexicon (Chaplain) on Jan 26, 2001 at 07:20 UTC
    Note that you don't want to use telnet at all if you are interested in security. Everything is transferred in plain text, including your login and password, making you highly vulnerable to anyone sniffing your network.

    SSH is technically crackable but this requires a fairly dedicated individual to get it right, as I understand it.

    -Lexicon