我正在尝试通过 Python 脚本通过 SSH 连接到服务器。目前我正在尝试 paramiko。我在客户端和服务器之间设置了一个公钥,所以我不需要密码。我目前正在使用以下代码:
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('192.168.56.102', 'oracle', None, '~/.ssh/id_rsa')
stdin, stdout, stderr = ssh.exec_command('ls')
但是当运行这个时,我得到了错误
[Errno -8] ai_socktype 不支持服务名
有什么帮助吗?