01-10-2023 01:37 AM
I am trying to remote copy running config to a server using code.
Every time I try to access it, it asks for a known hosts file confirmation dialog box for a new server and a password dialog box.
Can we skip these 2 steps and pass password to the scp in uri format.
Kindly help me out on this.
01-10-2023 03:24 AM
- Can you try with : copy running-config scp://root:password@x.x.x.x/locatio...
M.
01-10-2023 10:59 AM
Hello,
you could also configure an EEM script and then run the script whenever you want to backup the config using the command:
event manager run BACKUP_CFG_SCP
Action 8.0 and 9.0 are optional (if you use those, you also need to set the two environment variables at the top. IP addresses, usernames, and passwords obviously need to reflect your own.
event manager environment _email_server 192.168.1.33
event manager environment _email_to user@domain.com
!
event manager applet BACKUP_CFG_SCP
event none
action 1.0 info type routername
action 2.0 cli command "enable"
action 3.0 cli command "copy run scp:" pattern "Address"
action 4.0 cli command "192.168.1.10" pattern "username"
action 5.0 cli command "root" pattern "filename"
action 6.0 cli command "/backup/routers/$_info_routername-config" pattern "Password"
action 7.0 cli command "Passw0rd"
action 8.0 mail server "$_email_server" to "$_email_to" from "$_info_routername@domain.com" subject "SCP Backup completed" body "SCP Backup completed"
action 9.0 syslog priority informational msg "Config change detected. Copy to SCP succesfull"
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