标签: asyncssh

无法通过 AsyncSSH 连接,错误主机密钥不受信任

当我运行此脚本时,我收到SSH connection failed: Host key is not trusted错误,但即使连接到此主机以获取密钥,仍会收到此错误。

import asyncio, asyncssh, sys

async def run_client():
    async with asyncssh.connect('172.18.17.9', username="user", password="admin", port=9321) as conn:
        result = await conn.run('display version', check=True)
        print(result.stdout, end='')

try:
    asyncio.get_event_loop().run_until_complete(run_client())
except (OSError, asyncssh.Error) as exc:
    sys.exit('SSH connection failed: ' + str(exc))
Run Code Online (Sandbox Code Playgroud)

python ssh asyncssh

6
推荐指数
2
解决办法
6275
查看次数

标签 统计

asyncssh ×1

python ×1

ssh ×1