RE: Net::SSH and Net::FTP?

From: Mark Weisman (mark_at_mystic1.net)
Date: 12/03/03


Date: Tue, 2 Dec 2003 16:37:19 -0900
To: "Dan Muey" <dmuey@infiniplex.com>,	<beginners@perl.org>

Thanks for the reply Dan, the two remote servers do not have FTP running
on them, so they must initialize the FTP connection. I've now built the
scripts on their ends, I'm working on an SSH script that will login to
them and launch the scripts on each server. Got the traffic direction
thing going on, so I'm trying to figure out who can login where? I'll
post the results once they all work. Right in the middle of all this, my
primary server got upgraded to 5.6.1 so we'll see how that messes
everything up? Ever forward.

Sincerely in Christ,
Mark-Nathaniel Weisman
President / Owner
Outland Domain Group
Anchorage, Alaska

-----Original Message-----
From: Dan Muey [mailto:dmuey@infiniplex.com]
Sent: Tuesday, December 02, 2003 6:38 AM
To: beginners@perl.org
Subject: RE: Net::SSH and Net::FTP?

> >
> > I would like to use SSH to login to a remote system, then
> using FTP,
> > upload a file from the remote machine to another machine which will
> > display the data. If I can automate this process, I think
> I'll be in
> > great shape, tell me does this code seem like it would work
> for this?

Just a thought, if you're having trouble with the ssh part.

You could just use ftp for both servers?

    use Net::FTP;

    $ftpa = Net::FTP->new("a.host.name", Debug => 0)
      or die "Cannot connect to a.host.name: $@";
    $ftpb = Net::FTP->new("b.host.name", Debug => 0)
      or die "Cannot connect to b.host.name: $@";
 
    $ftpa->login($usera,$passa)
      or die "Cannot login to A", $ftp->message;
    $ftpb->login($userb,$passb)
      or die "Cannot login to B", $ftp->message;

    $ftpa->cwd("/files/blah")
      or die "Cannot change working directory A", $ftp->message;
    $ftpb->cwd("/foo/monkey")
      or die "Cannot change working directory B", $ftp->message;

    for(@filestotransfer) {
# then use $ftpa->read() and $ftpb->write() to xfr them between each
other,
# sorry for lack of example I'm a bit busy!
    }

    $ftpa->quit;
    $ftpb->quit;

Transfer files back and forth between the 2 Net::FTP objects. I'm not
saying it's better or anythgin, just another way to do it that may help
if ssh is being tricky as it some times can.

HTH

DMuey

-- 
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org


Relevant Pages

  • Re: Anti-virus Programs
    ... As for SMB/CIFS filesystems shared with Windows systems I use Clamav to ... SSH vulnerability. ... users who have remote shell access. ... But poorly setup mail servers are possibly the worst because your ...
    (Fedora)
  • Re: Flood blocking
    ... FTP and e-mail ... servers that send you a lot of email will tend to get blocked.) ... And then there's the e-mail spam that also doesn't stop. ... If you just use ssh based file ...
    (Fedora)
  • Re: VPN, FTP, or remote desktop
    ... I would recommend a VPN versus FTP simply because of security issues. ... You could also look at using Secure Shell (SSH) versus VPN. ... require a PC at either site to be running as a SSH server for remote access. ...
    (microsoft.public.windowsxp.network_web)
  • Re: Net::SSH and Net::FTP?
    ... > I would like to use SSH to login to a remote system, then using FTP, ... instance your SSH pipe is going to throw the username at the FTP client ...
    (perl.beginners)
  • Re: [opensuse] Re: 11.2 - what was the reasoning behind disabling sshd by default?
    ... it's true that at least the smart ones try to make sure they have specifically set that setting during install so that when it reboots they are not screwed. ... In my case I simply do not attempt to do remote installs without remote serial console or ip-kvm. ... Because with the installer defaulting ssh off, every install is a nailbiting experience, or rather, you just have to avoid reinstalls even more than usual since it's irresponsible to take the risk of the box going unavailable. ... So, I'm still ok using opensuse for servers, but it's in part because I do not rely on always remembering that ssh setting during manual installs. ...
    (SuSE)