Netmiko MikroTik RouterOS SSH-Schlüssel-Login-Beispiel
English
Deutsch
In unserem vorherigen Beispiel Netmiko MikroTik RouterOS minimales Beispiel haben wir gezeigt, wie man sich mit netmiko und passwortbasiertem Login an einem RouterOS-Gerät anmeldet.
mikrotik_ssh_key_login.py
#!/usr/bin/env python3
from netmiko import ConnectHandler
import os.path
mikrotik = {
'device_type': 'mikrotik_routeros',
'host': '192.168.88.1',
'username': 'admin',
'key_file': os.path.expanduser("~/.ssh/id_mikrotik"),
}
with ConnectHandler(**mikrotik) as mikrotik_connection:
print(mikrotik_connection.send_command(f'/system/identity/print', cmd_verify=False))Beispiel-Ausgabe:
mikrotik_identity_output.txt
name: MySwitch01Check out similar posts by category:
MikroTik, Networking, Python
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow