Skip to content
This repository has been archived by the owner on Oct 24, 2021. It is now read-only.
/ mikrotik-ctrl Public archive

Shell script that deploys RSA keys and executes commands on Mikrotik RouterOS/SwitchOS devices

Notifications You must be signed in to change notification settings


Folders and files

Last commit message
Last commit date

Latest commit



17 Commits

Repository files navigation

Now that I discovered ansible, this repo shall carry only historical value and not be used in any way


avg mikrotik user


  • fairly modern bash
  • ftp enabled on devices (one time requirement to deploy keys, later on only ssh will be used)
  • ssh-server enabled
  • modern RouterOS/SwitchOS

Basic usage

Executing script

Set executable bit on with chmod +x and run it with sh or ./
Script will ask you for login credentials and IP address of device you wish to manage and deploy RSA keys

You can specify IP address or populate ip.txt file with ip addresses that will be used

On devices - sepatate user will be created, this user will be named as login you specified while running script with addition of _ssh to user name

Later you can use ssh passwordless login using your ~/.ssh/id_rsa key with this user name. ex: admin_ssh@

payload.txt file

payload.txt contains list of commands that will be executed on selected host or group of hosts from ip.txt

ip.txt file

You can populate ip.txt file in directory where script is placed with IP addresses of devices that will receive keys and commands to execute from payload.txt file.

autologin-enabled-devices.txt file

This file contains IP's of devices that scritps had previously deployed keys to, this devices is ignored wher key-check phase is run


Simple SNMP configuration provisioning

File ip.txt is populated with:

File payload.txt contains:

/snmp community set [ find default=yes ] addresses=
/snmp set contact=geexmmo enabled=yes location=branch-server-room trap-version=2

Result: Mikrotik devices will now accept SNMP collector from my Zabbix instance on


Shell script that deploys RSA keys and executes commands on Mikrotik RouterOS/SwitchOS devices







No releases published


No packages published