Deprecated: Hook custom_css_loaded is deprecated since version jetpack-13.5! Use WordPress Custom CSS instead. Jetpack no longer supports Custom CSS. Read the WordPress.org documentation to learn how to apply custom styles to your site: https://wordpress.org/documentation/article/styles-overview/#applying-custom-css in /srv/www/srvfail.com/public_html/wp-includes/functions.php on line 6078
backup Archives ⋆ SysAdminStuff

Automatic backup of Ubiquiti ES-48-LITE over SSH

Ubiquiti ES-48-LITE currently doesn’t have an option to copy startup config to remote machine over scp.

This script will connect to Ubiquiti EdgeSwitch  over SSH and save startup config locally on machine running the script.

#!/usr/bin/expect -f

set user "username"
set sshpass "password for ssh access"
set enablepass "password for enable mode"
set device "device IP or hostname"
set cfgbackup "/path/to/save/config"

spawn ssh $user@$device

expect "assword:"
send "$sshpass\r"

expect ">"
send "enable\r$enablepass\rterminal length 0\r"

expect "#"
log_file -noappend $cfgbackup
send "show startup-config\r"
expect "#\n"
log_file

send "exit\rexit\r"

exec /bin/sed -i {1d;$d} $cfbbackup