我正在关注RyPC website的例子 但我似乎无法让它发挥作用。我的代码如下:
#!/usr/bin/python
from rpyc.utils.zerodeploy import DeployedServer
from plumbum import SshMachine
# create the deployment
mach = SshMachine("ec2.myhost.com")
server = DeployedServer(mach)
# and now you can connect to it the usual way
conn1 = server.classic_connect()
print conn1.modules.sys.platform
conn2 = server.classic_connect()
print conn2.modules.os.getpid()
# when you're done - close the server and everything will disappear
server.close()
我从本地服务器连接到EC2实例。我打开了所有的端口以防万一。没有。对于localhost-> ec2,我得到以下内容:
Enter passphrase for key '/home/crazybeardedman/.ssh/id_dsa':
Traceback (most recent call last):
File "./test_stage.py", line 7, in <module>
mach = SshMachine("stage")
File "/usr/local/lib/python2.7/dist-packages/plumbum/machines/ssh_machine.py", line 106, in __init__
new_session = new_session)
File "/usr/local/lib/python2.7/dist-packages/plumbum/machines/remote.py", line 129, in __init__
self._session = self.session(new_session = new_session)
File "/usr/local/lib/python2.7/dist-packages/plumbum/machines/ssh_machine.py", line 150, in session
self.encoding, isatty, self.connect_timeout)
File "/usr/local/lib/python2.7/dist-packages/plumbum/machines/session.py", line 141, in __init__
self.run("")
File "/usr/local/lib/python2.7/dist-packages/plumbum/machines/session.py", line 224, in run
return run_proc(self.popen(cmd), retcode)
File "/usr/local/lib/python2.7/dist-packages/plumbum/commands/processes.py", line 186, in run_proc
stdout, stderr = proc.communicate()
File "/usr/local/lib/python2.7/dist-packages/plumbum/machines/session.py", line 92, in communicate
line = pipe.readline()
File "/usr/local/lib/python2.7/dist-packages/plumbum/machines/session.py", line 42, in readline
raise EOFError()
EOFError
我需要对sshd或身份验证(使用pam和ldap)执行此操作吗?