尝试运行命令 ssh user@ip 'command'
时,我不断收到此错误:无法获取 tty 设置无法设置 orig 模式
。我试过用谷歌搜索并在这里搜索,但没有找到任何与此消息相关的内容。我正在尝试使用 Golang 自动连接到 Cisco 无线接入点(2800 型号)以运行命令然后退出,但每次都会弹出此消息。我可以使用 ssh user@ap_ip
正常登录,但使用简写 ssh user@ap_ip 'command'
或尝试 Golang 中的等效项会给出上面的错误消息。有人知道这是怎么回事吗?
最佳答案
没有给出明确命令的 ssh 将分配一个终端,而带有给定命令的 ssh 默认情况下不会。看起来您执行的命令需要一个终端。在这种情况下,使用 -t
选项,即 ssh -t user@ip command
。来自 the documentation :
-t Force pseudo-terminal allocation. This can be used to execute
arbitrary screen-based programs on a remote machine, which can be
very useful, e.g. when implementing menu services. Multiple -t
options force tty allocation, even if ssh has no local tty.
关于go - SSH 未知 TTY 错误消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50219120/