Simple SSH backup of routeros / mikrotik

Prerequisites:

  • A linux host within your network
  • SSH enabled on your router
  • FW routes from host to router

Howto:

1. Create ssh keys (without passphrase) on the linux host: ssh-keygen

2. Copy ~/.ssh/id_rsa.pub , put in a .txt file, upload to routeros

3. Create a read only user

4. In the user menu, go to SSH keys, add the SSH key to the user

5. Add cronjob on linux host:

33 3 * * * root /usr/bin/ssh backup@10.0.60.1 '/export' > /backup/ROUTEROS.export.txt