【发布时间】:2012-11-08 20:36:51
【问题描述】:
我正在尝试通过 SSH 连接到正在运行的 EC2 实例,但每次都会出现以下错误。
import os
import boto.manage.cmdshell
ec2 = boto.connect_ec2()
key_dir= '~/'
key_name='keypair'
key_extension='.pem'
key_path = os.path.join(os.path.expanduser(key_dir),
key_name+key_extension)
reservations = ec2.get_all_instances()
instance = reservations[0].instances[0]
cmd = boto.manage.cmdshell.sshclient_from_instance(instance,
key_path,
host_key_file='~/.ssh/known_hosts',
user_name='ec2-user')
cmd.shell()
Traceback(最近一次调用最后一次): 文件“/home/.../FirstModule.py”,第 26 行,在 cmd.shell() 文件“/usr/lib/python2.7/dist-packages/boto/manage/cmdshell.py”,第 114 行,在 shell 交互式外壳(通道) 文件“/usr/lib/python2.7/dist-packages/boto/mashups/interactive.py”,第 34 行,interactive_shell posix_shell(chan) posix_shell 中的文件“/usr/lib/python2.7/dist-packages/boto/mashups/interactive.py”,第 42 行 oldtty = termios.tcgetattr(sys.stdin) termios.error: (22, '无效参数')
知道为什么会出现这个错误吗?
【问题讨论】:
标签: amazon-web-services python-2.7 boto