【发布时间】:2016-02-23 05:23:12
【问题描述】:
我正在尝试通过 python boto ssh 模块(使用 paramiko 包)中的 ssh 对 AWS EC2 实例远程运行一些命令。我正在使用 boto.manage.cmdshell.sshclient_from_instance.run 工作正常,但问题是 .run 无法远程执行 sudo 命令。我收到此错误消息:
sudo: sorry, you must have a tty to run sudo
我知道我可以手动登录和编辑权限来解决这个问题,但我希望这部分也能自动化。我可以使用 .shell 启动交互式 shell,但有没有办法使用 python 在交互式 shell 中自动执行命令?
【问题讨论】:
标签: python shell amazon-web-services ssh