cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
264
Views
1
Helpful
2
Replies

sftp kron job

wrunkle
Level 1
Level 1

Hi, 

i have a known good working route to my sftp server, but seem unable to make it run as a kron operation. it just doesn't do anything!

It is configured as follows:

hostname# show run | section kron
kron occurrence nightly at 2:30 recurring
policy-list runconfbackup
kron policy-list runconfbackup
cli show run | redirect sftp://blah:blah@someip/etc/etc

I am wondering whether it may expect additional input for the sftp operation as when running sftp as a standalone command it asks to verify the destination and login... but don't know if that can be turned off...?

 

 

I am wondering whether it may be that on firing it requires additional input - shown below:

hostname# copy running-configsftp://blah:blah@someip/etc/etc
Address or name of remote host [someip]?
Destination username [etc]?
Destination filename [etc/xxconfg]?

a show kron schedule gives:

Kron Occurrence Schedule
nightly inactive, will run again in 0 days 16:18:06 at 2 :30 on

 

 

1 Accepted Solution

Accepted Solutions

M02@rt37
VIP
VIP

hello @wrunkle 

Kron jobs are non-interactive, meaning they cannot handle user input prompts. If the SFTP command expects confirmation or input for the host, username, or filename, it will fail silently because Kron can't respond to these prompts.

If the SFTP server is prompting for host key verification, some SFTP servers or clients allow you to disable this. However, this is risky from a security standpoint, as it disables checking whether you're connecting to the correct server. Still, if this is acceptable in your environment, you can try disabling host key verification.

For example, if your Cisco device supports SSH/SFTP options that disable host verification, you'd want to look for an option like StrictHostKeyChecking no, but Cisco IOS might not have such fine-grained SFTP/SSH settings directly configurable. You'd need to consult the SFTP server for alternative configurations.

Best regards
.ı|ı.ı|ı. If This Helps, Please Rate .ı|ı.ı|ı.

View solution in original post

2 Replies 2

M02@rt37
VIP
VIP

hello @wrunkle 

Kron jobs are non-interactive, meaning they cannot handle user input prompts. If the SFTP command expects confirmation or input for the host, username, or filename, it will fail silently because Kron can't respond to these prompts.

If the SFTP server is prompting for host key verification, some SFTP servers or clients allow you to disable this. However, this is risky from a security standpoint, as it disables checking whether you're connecting to the correct server. Still, if this is acceptable in your environment, you can try disabling host key verification.

For example, if your Cisco device supports SSH/SFTP options that disable host verification, you'd want to look for an option like StrictHostKeyChecking no, but Cisco IOS might not have such fine-grained SFTP/SSH settings directly configurable. You'd need to consult the SFTP server for alternative configurations.

Best regards
.ı|ı.ı|ı. If This Helps, Please Rate .ı|ı.ı|ı.

wrunkle
Level 1
Level 1

ok, that was kinda where i was going, thanks!

Review Cisco Networking for a $25 gift card