hello everybody ;
is there a way to set a rule or something to send back up to email automatically like everyday ? and does it send a backup even if the password of mikrotik has changed ?
in Tools-Email put credentials to e-mail
create script:
/export file="config"
/tool e-mail send to=email_to_send@domain.com subject="config export " file="config.rsc"
put this script in scheduler
it will send backup even if you will change password
I do this every night on both my routers. Here is the script that I use.
/system script
add name="Daily Backup" owner=Admin policy=ftp,read,policy,test,sensitive \
source="# Policies needed: ftp, read, policy, sensitive, test\r\
\n# Policies NOT needed: password, reboot, write, sniff, romon\r\
\n:log info \"Starting daily backup\";\r\
\n/system backup save name=RB750-1_Daily\r\
\n:delay 00:00:01\r\
\n/tool e-mail send file=RB750-1_Daily.backup to=\"my_E-Mail@address\" body=\"\
Router #1 daily backup file attached.\" \\\r\
\n subject=\"RB750-1 \$[/system clock get date] at \$[/system clock get\
\_time] Backup\"\r\
\n/ export file RB750-1_Daily\r\
\n:delay 00:00:10\r\
\n/tool e-mail send file=RB750-1_Daily.rsc to=\"my_E-Mail@address\" body=\"Rou\
ter #1 daily script file attached.\" \\\r\
\n subject=\"RB750-1 \$[/system clock get date] at \$[/system clock get\
\_time] Script\"\r\
\n:log info \"Daily backup script completed\"\r\
\n"
To use this, the E-Mail settings for server, ID and password must have already been set:
/tool e-mail
set address=smtp.gmail.com from="Router #1" password=Redacted port=587 \
start-tls=yes user=The_sending_address@gmail.com
I then have a scheduled event to execute the script every night:
/system scheduler
add interval=1d name="Daily backup" on-event="Daily Backup" policy=\
ftp,read,write,policy,test,password,sniff,sensitive start-date=\
jul/12/2016 start-time=22:31:00
Obviously in both code segments, I have redacted some sensitive information.
thank you for replaying
but lets say my router got hacked and they changed the password will it send the new password in the next backup ?
and K6ccc do i have to use these 3 scripts ? or the 1st one would do it ?
and where to paste it ? in terminal ?
[quote=“darkoknght”]
but lets say my router got hacked and they changed the password will it send the new password in the next backup ?
/quote]
no, there are no password in config export, password can be in backup, but you also can’t look for it.
as a variant you can send all *.rsc files to your mail (usually, but not always, routers a hacked by bots and they leave rcs files on router)
if you are lucky to have access to you router (even with read rights) you can transfer a script to router and it will run automatically. in script you can create a new user with admin rights
so even if i got the backup i can’t read it ?
yes, you can’t read user password because of security reasons.
but if you have a backup (or config export) with last configuration you can rather fast reset your device and restore actual configuration
Sending backups to email is bad for multiple reasons.
Security, scalability, management (imagine you need to change the email address, or email credentials on 100 devices), etc.
You should look at a proper backup solution, such as Unimus, Rancid or Oxidized.
yeah i guess you are right but it would really be nice to have a backup like every 12 or 24 hours so what ever happens you can roll back 12 or 24 hours only and i will check out the links but which one is the best ?
You can configure any of them to take a backup every 12h or 24h.
Unimus is the simplest to setup, fastest to use, and has nice things like graphical diff (see changes between backups, or between devices), and a network-wide config search.
(type in “vlan 1002” and see everywhere in your network that is configured)
But it’s a commercial product - the other are open source (free).
i make virtual linux machine which connect through ssh to router and backup all..![]()
okay thanks you for the help guys ![]()
Sorry for the delay - busy weekend…
You need to run all three. The first one is the script that will create and send the backups. That gets run as often as you want to back up the configs - in my case daily. The second is just your e-Mail setup and you do it only one time. The third sets up a schedule for when the first one should run automatically. That also needs to be run just once.
You can build these from a terminal, WebFig, or WinBox
Agreed that backing up via E-Mail has some issues. In my case, it’s just my two routers at home, and the backups are going through my own mail server, so your three limitations listed are not really much of an issue - at least for me.
thank you k6ccc and thaks everybody you are the best ![]()