首页 > fabric连接远程主机时报:Unable to connect to port 22 on 的异常?

fabric连接远程主机时报:Unable to connect to port 22 on 的异常?

按照 fabric 的官方文档写的一段简单代码:

from fabric.api import run

def host_type():
    run('uname -s')

运行时:zmrenwu@sheepx:~/test_folder$ fab -H yangxg.top host_type

主机的域名是: yangxg.top

得到如下的异常信息:

zmrenwu@sheepx:~/test_folder$ fab -H yangxg.top host_type
[yangxg.top] Executing task 'host_type'
[yangxg.top] run: uname -s

Fatal error: Low level socket error connecting to host yangxg.top on port 22: Unable to connect to port 22 on  or 23.83.225.228 (tried 1 time)

Underlying exception:
    Unable to connect to port 22 on  or 23.83.225.228

Aborting.

为什么会出现这种情况?可以保证远程主机的 ssh 服务已经开启了的,使用 putty 等工具可以连接。fabric 版本是 1.10.2, python 版本 2.7

求指教!


你是不是改了 ssh 的端口号?

【热门文章】
【热门文章】