[Ssh-sftp-perl-users] RE : Re: Scp capability but no sftp capability
Brought to you by:
dbrobins
From: Mik J <mik...@ya...> - 2008-01-16 22:13:43
|
Thank you, --- Heiko Jansen <ja...@hb...> a écrit : > > I have a Cisco router on which I'm able to scp the > > configuration file in command line but sftp > > doesn't work from the command line. > > I'd like to know if Net::SFTP is able to connect > > to the routeur in the scp mode only not using the > > sftp functionality. > > From what I see in the docs, I'd say no. Besides, > it is explicitly named Net::SFTP... I read correctly the name of this module and I know it's SFTP. But it seemed strange to me that there was a SSH module, a SFTP module and no SCP. I thought the SCP functionality was included in the SFTP module. > I'd suggest using Net::SCP (which is only a wrapper > around the command line scp) I can't use the Net::SCP for the reason below "Q: How do you supply a password to connect with ssh within a perl script using the Net::SSH module? A: You don't (at least not with this module). Use RSA or DSA keys. See the quick help in the next section and the ssh-keygen(1) manpage. A #2: See Net::SCP::Expect instead. " My routers accept only password authentication. > or - presumably even > better - Net::SSH2 which has a built-in > scp subcommand. I did not manage to make Net::SSH2 with the scp option to work when trying to secure copy my router's configuration. #!/usr/bin/perl use Net::SSH2; $cisco = '10.1.1.1'; $user = 'miky'; $pass = 'mypass'; $cfg_run = 'RUNCFG'; $cisco_run = 'running-config'; my $ssh2 = Net::SSH2->new(); $ssh2->debug(1); $ssh2->connect($cisco) or warn "Can't open connection to $host\n"; $ssh2->auth_password($user, $pass); $ssh2->scp_get($cisco_run,$cfg_run); print "\n"; $ ./scpcisco.pl libssh2_scp_recv(ss->session, path, &st) -> 0x0 Net::SSH2::DESTROY object 0x80e0d40 and the file RUNCFG is not created _____________________________________________________________________________ Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail http://mail.yahoo.fr |