Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^3: How can I connect to a Linux Machine from a Windows Box

by regexes (Hermit)
on Apr 05, 2007 at 12:54 UTC ( [id://608472]=note: print w/replies, xml ) Need Help??


in reply to Re^2: How can I connect to a Linux Machine from a Windows Box
in thread How can I connect to a Linux Machine from a Windows Box

Hello,

Since you didn't have a Net::Telnet example.... I find that it works well for me. It shouldn't matter if you're on a Windows box or not. As long as the telnetd is running on the Linux machine.
Of course, I use this in an internal network.
my $host = "host123"; my $username = "bobjones"; my $password = "mypassword"; my $thost = new Net::Telnet( Timeout => 20, Host => $host, Errmode => "return" ); $thost->login( $username, $password ); my $prompt = "_MYPROMPT_"; $thost->prompt("/$prompt\$/"); $thost->cmd("set prompt = '$prompt'"); # depends on the shell in +use. my $command = "ls"; my @out = $thost->cmd($command); $thost->close;
getting a directory listing, then creating a directory in /temp, copying a .tar file from my local windows PC to this folder, extracting it and then running the setup program...

All of the above can be done with Net::Telnet... (I don't know about the copying... I haven't tried that. I usually use Net::FTP for that..)

Hope it helps...
regexes


-------------------------
Cave ab homine unius libri

Replies are listed 'Best First'.
Re^4: How can I connect to a Linux Machine from a Windows Box
by blackadder (Hermit) on Apr 05, 2007 at 14:16 UTC
    Thanks

    I will try it

    I am having a look at this node as well
    http://www.perlmonks.org/?node_id=538184
    Blackadder
Re^4: How can I connect to a Linux Machine from a Windows Box
by blackadder (Hermit) on May 03, 2007 at 12:13 UTC
    HELP!

    I have tried this
    #! c:/perl/bin/perl.exe use strict; use Net::SSH::Perl; use Net::Telnet; my $ssh = Net::SSH::Perl->new("RVM701"); $ssh->login("root", "password");
    And I got this in retun!
    F:\SDK\Scripts\D&A>vmlicecheck1.pl The getpwuid function is unimplemented at C:/Perl/site/lib/Net/SSH/Per +l.pm line 110.
    Then I tried this
    my $host = "RVM701"; my $username = "root"; my $password = "password"; my $thost = new Net::Telnet( Timeout => 20, Host => $host, Errmode => "return" ); $thost->login( $username, $password ); my $prompt = "_MYPROMPT_"; $thost->prompt("/$prompt\$/"); $thost->cmd("set prompt = '$prompt'"); # depends on the shell in +use. my $command = "ls"; my @out = $thost->cmd($command); $thost->close;
    And this was the result!
    F:\SDK\Scripts\D&A>vmlicecheck1.pl Can't call method "login" on an undefined value at F:\SDK\Scripts\D&A\ +VmLicechec k1.pl line 24.
    Please, Can I rely on your legendry kindness and get enlightenment on what’s wrong and how can I rectify this please? Thanks indeed

    Cheers

    ********************* UPDATE *************************

    Only SSH service is available on the linux servers! cannot use FTP or Telenet!

    Any Clues for me Please?
    Blackadder

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://608472]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-25 09:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found