10-18-2012 08:42 AM
Hello All,
I would need your help about the following :
let's say that I have a file stored on "disk0a:/usr/" and it's name is "_debug.dat"
and I want to transfer that file using SSH to home directory "nikos" on the server "1.1.1.1" and the password would be "123abc!"
So, teh command would be :
sftp disk0a:/usr/_debug.dat nikos@1.1.1.1:/home/nikos/
then I'll be prompted for password, and the transfer will be completed.
My question is how to do that using Tcl/EEM and without be prompted for password ?
I know that there is a -force option, but I haven't made it working.
Kind Regards,
Nikos
10-18-2012 04:31 PM
You will always be prompted, but you can answer the prompt within EEM. For example:
cli_write $cli(fd) "sftp disk0a:/usr/_debug.dat nikos@1.1.1.1:/home/nikos/"
cli_read_pattern $cli(fd) "password"
cli_write $cli(fd) "123abc!"
10-19-2012 01:35 AM
Thank you Joseph,
Here is what was written :
set cmd "sftp disk0a:/usr/flow01_key
" ;
if [ catch {cli_write $clifd(fd) $cmd} rc ] {
error $rc $errorInfo
}
if [ catch {cli_read_pattern $clifd(fd) "Password:"} rc ] {
error $rc $errorInfo
}
if [ catch {cli_write $clifd(fd) "abc123!"} rc ] {
error $rc $errorInfo
}
but, what I see in the logs is :
RP/0/RSP0/CPU0:Oct 19 10:47:48.012 CET: ssh[65866]: %SECURITY-SSHD-3-ERR_SYSDB_DELETE : sysdb_item_delete failed for tuple 28488010 in function ssh_kexinfo_tuple()
do you have any idea how to bypass this ?
10-20-2012 04:36 PM
This doesn't appear to be an EEM problem per se, but a problem with SSH on the device. Unfortunately, I don't have an IOS-XR device with which to test, but I don't see any problem in this code (provided the sftp command prompt does contain the pattern "Password:").
11-09-2012 11:37 AM
I didn't think Cisco supported sftp?
Router#copy running-config ?
archive: Copy to archive: file system
flash: Copy to flash: file system
ftp: Copy to ftp: file system
http: Copy to http: file system
https: Copy to https: file system
idconf Load an IDConf configuration file
null: Copy to null: file system
nvram: Copy to nvram: file system
rcp: Copy to rcp: file system
running-config Update (merge with) current system configuration
scp: Copy to scp: file system
startup-config Copy to startup configuration
syslog: Copy to syslog: file system
system: Copy to system: file system
tftp: Copy to tftp: file system
tmpsys: Copy to tmpsys: file system
Thanks, Pat
11-11-2012 08:41 AM
The question here is about IOS-XR.
11-12-2012 05:12 AM
Oh, ok.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide