[Ssh-sftp-perl-users] RE : Re: Scp capability but no sftp capability
Brought to you by:
dbrobins
From: Mik J <mik...@ya...> - 2008-01-18 16:23:22
|
--- Heiko Jansen <ja...@hb...> a écrit : > Am Mittwoch, den 16.01.2008, 23:13 +0100 schrieb Mik > J: > > > > > 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. > > So you try Net::SCP::Expect instead, as proposed. > > > 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 > > First, make sure you have libssh2 0.18 and Net::SSH2 > 0.18. Previous > versions had problems. I was using the 0.17 version > Even though I have these versions your script did > not work for me at > first either: when I started it, it simply hang > without printing any > debug messages... > I had to replace "auth_password" with > "auth_keyboard" to get it to work. I made this replacement but it did not work My script already works with Net::Telnet::Cisco or Net::Telnet but I wanted it to work with a secure protocol such as ssh. I didn't try to make it work with snmp because I dont know much about this protocol except that it's quite difficult to make things due to different OID on different IOS Thanx for you two, I guess that it won't work this way. I'm working on the other side with Net::Appliance::Session through ssh (not scp) _____________________________________________________________________________ Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail http://mail.yahoo.fr |