MikroTik Config File .backup vs .rsc – Automate Configuration Backup to FTP Server!

MikroTik Config File .backup vs .rsc – Automate Configuration Backup to FTP Server!

Backing up your network device configuration is one of the most important tasks in network administration. Imagine spending hours configuring your MikroTik router, only to lose everything because of hardware failure, accidental configuration changes, or an unexpected system issue.

Having a regular configuration backup can save you a lot of time and effort when something goes wrong.

MikroTik RouterOS provides several ways to back up your configuration. You can create a backup manually, use scripts and schedulers to automate the process, or use MikroTik's own Cloud Backup service.

In this tutorial, I'll show you how to automate MikroTik configuration backups using RouterOS Script and Scheduler. We'll also configure the router to upload the generated backup files to an external FTP server or NAS and optionally delete the local copies after a successful upload.

1. Understanding MikroTik Backup File Formats: .backup vs .rsc

Before creating an automated backup, it's important to understand the two common configuration backup formats available in MikroTik RouterOS: .backup and .rsc.

Although both can be used to preserve your router configuration, they work differently.

.backup – Binary Backup Format

The .backup file is MikroTik's binary backup format.

Unlike a regular text file, its contents cannot be easily opened or read using a standard text editor. It can also be protected using encryption and a password.

This format is generally suitable when you want to restore a router's configuration as a device backup, preferably to the original device or compatible hardware.

.rsc – Human-Readable Configuration Export

The .rsc file is different because it contains configuration commands in plain text format.

You can open it using a regular text editor, review the configuration, and modify commands before importing them into another MikroTik device.

This makes .rsc particularly useful when migrating configurations between different MikroTik models or adapting an existing configuration to new hardware.

However, keep in mind that an .rsc export is not a complete replacement for a binary backup. Some sensitive information and certain databases or device data are not included in a standard export.

Which Format Should You Use?

For my configuration backup workflow, I prefer using .rsc.

The main reason is flexibility. I want to be able to read the configuration, review it, and adapt it when moving to another MikroTik device.

For this tutorial, we'll use the .rsc format.

2. Creating a MikroTik Configuration Backup

There are different ways to create these backup files.

For a .backup file, you can use the Backup option in the WinBox Files menu. You can specify the filename and configure password protection and encryption.

For an .rsc file, you can use the CLI terminal.

Simply execute the following command:

/export file=backup-config

MikroTik will generate a configuration export file named:

backup-config.rsc

You can find the generated file in the Files menu.

Creating backups manually is fine when you only manage one or two routers. However, it becomes inconvenient when you manage multiple devices or need to maintain a regular backup schedule.

Instead of creating backups manually, we can automate the process using two built-in RouterOS features:

  • System Script: Stores the commands used to generate and upload the backup.
  • System Scheduler: Executes the script automatically at a specified time interval.

Let's build the automation.

3. Creating an Automated Backup Script

The first step is to create a script that generates an .rsc configuration export.

I want the backup filename to include two pieces of information:

  • The current date.
  • The MikroTik system identity or hostname.

This makes it easier to identify which router generated the backup and when it was created.

For example, the filename could look like this:

2026-11-03-IDJELAMCRR0.rsc

Here's the script:

:local sysname [/system identity get name]
:local textfilename
:local time [/system clock get time]
:local date [/system clock get date]
:local newdate "";
:for i from=0 to=([:len $date]-1) do={ :local tmp [:pick $date $i];
:if ($tmp !="/") do={ :set newdate "$newdate$tmp" }
:if ($tmp ="/") do={}
}
#check for spaces in system identity to replace with underscores
:if ([:find $sysname " "] !=0) do={
:local name $sysname;
:local newname "";
:for i from=0 to=([:len $name]-1) do={ :local tmp [:pick $name $i];
:if ($tmp !=" ") do={ :set newname "$newname$tmp" }
:if ($tmp =" ") do={ :set newname "$newname_" }
}
:set sysname $newname;
}
:set textfilename ($"newdate" . "-" . $"sysname" . ".rsc")
:execute [/export file=$"textfilename"]
#Allow time for export to complete
:delay 2s

4. Automating the Backup Using Scheduler

Now that we have our backup script, let's automate it.

Open WinBox and navigate to:

System → Scheduler

Add a new scheduler entry and configure the following parameters:

ParameterExample configuration
Namedaily-config-backup
Start Time03:00:00
Interval1d 00:00:00
On EventName of your backup script

The most important parameter here is Interval.

For example:

1d 00:00:00

This tells MikroTik to execute the scheduler every 24 hours.

In the On Event field, enter the name of the script you created earlier.

Make sure the scheduler and script have sufficient permissions to execute the commands they need.

Once everything is configured, your MikroTik router will automatically generate an .rsc backup every day.

5. Uploading Backup Files to an FTP Server or NAS

Generating backup files automatically is a good start, but I don't recommend keeping all your backup files only inside the MikroTik device.

What happens if the router experiences a hardware failure?

You could lose access to both the router and the backup files stored inside it.

For this reason, I prefer keeping another copy of the backup on external storage, such as a NAS or FTP server.

In my case, I have a NAS with FTP service enabled.

Fortunately, MikroTik RouterOS provides a built-in tool called Fetch, which can transfer files using FTP and other supported protocols.

We can use the Fetch command to upload the generated .rsc file to our FTP server.

Here's an example:

tool fetch url="ftp://192.168.85.5/Config-Backup/Router/IDJELAMCRR0/$textfilename" src-path=$textfilename user=backup-user password=Backup1234 port=21 upload=yes

Let's understand the parameters:

  • address: The IP address of your FTP server.
  • src-path: The name of the backup file stored on your MikroTik device.
  • dst-path: The destination folder and filename on the FTP server.
  • user: FTP account username.
  • password: FTP account password.
  • port: FTP service port, commonly port 21.
  • upload=yes: Tells Fetch to upload the file instead of downloading it.

Make sure the destination directory already exists and that your FTP account has permission to upload files.

You can adjust the destination path according to your FTP server's directory structure.

After adding this command to your backup script, you can test it by running the script manually.

Then, check your NAS or FTP server to confirm that the backup file has been uploaded successfully.

Why Store Backups on External Storage?

Keeping backups outside the router provides an additional layer of protection.

Even if the MikroTik device becomes unavailable, you can still access the backup files stored on your NAS or FTP server.

For production environments, I recommend using SFTP instead of standard FTP whenever possible. Standard FTP does not encrypt credentials or file contents during transmission.

Also, avoid storing real passwords in scripts that are shared or exported without appropriate protection.

6. Automatically Delete Local Backup Files

There's one more improvement we can make.

After uploading the backup file to the FTP server, we might not want to keep another copy inside the MikroTik device.

This can be useful, especially when working with routers that have limited internal storage.

We can use the following command:

/file remove $textfilename

Place this command after the FTP upload operation.

The important thing is to remove the local file only after confirming that the upload has completed successfully.

I don't recommend relying only on a five-second delay to determine whether an upload has succeeded. A delay does not guarantee that the FTP transfer was successful.

For a production setup, use Fetch's result or RouterOS error handling to ensure that the local file is removed only after a successful upload.

If the upload fails, keep the local backup so you have another copy to recover from.

7. Final Thoughts

And that's how I automate configuration backups on my MikroTik routers.

With this setup, we can:

  1. Automatically export the MikroTik configuration into an .rsc file.
  2. Generate backup filenames containing the date and router identity.
  3. Schedule the backup process to run automatically every day.
  4. Upload the generated backup files to an FTP server or NAS.
  5. Remove local backup copies after successful uploads, when desired.

For my own environment, I prefer using .rsc backups and storing them on an external NAS because they are easier to review, manage, and adapt when migrating configurations between different MikroTik devices.

Remember, a backup is only useful when you can successfully restore it. Always test your backup and restoration process before relying on it in a production environment.

I hope this tutorial helps you build a more reliable backup system for your MikroTik network.

Thanks for reading, and see you in the next tutorial!

Full Script

:local sysname [/system identity get name]
:local textfilename
:local time [/system clock get time]
:local date [/system clock get date]
:local newdate "";
:for i from=0 to=([:len $date]-1) do={ :local tmp [:pick $date $i];
:if ($tmp !="/") do={ :set newdate "$newdate$tmp" }
:if ($tmp ="/") do={}
}
#check for spaces in system identity to replace with underscores
:if ([:find $sysname " "] !=0) do={
:local name $sysname;
:local newname "";
:for i from=0 to=([:len $name]-1) do={ :local tmp [:pick $name $i];
:if ($tmp !=" ") do={ :set newname "$newname$tmp" }
:if ($tmp =" ") do={ :set newname "$newname_" }
}
:set sysname $newname;
}
:set textfilename ($"newdate" . "-" . $"sysname" . ".rsc")
:execute [/export file=$"textfilename"]
#Allow time for export to complete
:delay 2s


#upload file to ftp
tool fetch url="ftp://192.168.85.5/Config-Backup/Router/IDJELAMCRR0/$textfilename" src-path=$textfilename user=backup-user password=Backup1234 port=21 upload=yes

#Allow time to send
:delay 5s

#delete copies
/file remove $textfilename