Files
SnarfCode/scripts/check_ha_ssh.py

20 lines
559 B
Python

import paramiko
import sys
sys.stdout.reconfigure(encoding='utf-8')
key_path = r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet'
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
try:
c.connect("14.4.4.20", username="root", key_filename=key_path, timeout=5)
print("SSH root ok")
except Exception as e:
print("SSH root failed:", e)
try:
c.connect("14.4.4.20", username="snarf", key_filename=key_path, timeout=5)
print("SSH snarf ok")
except Exception as e2:
print("SSH snarf failed:", e2)