go - SSH 未知 TTY 错误消息

标签 go ssh network-programming cisco

尝试运行命令 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/

相关文章:

由于 : "go directory outside available modules",Docker 构建失败

methods - 方法接收者

unit-testing - 如何对pubsub进行单元测试接收回调

git - Vagrant ansible git clone 权限错误

ssh - 从Ansible执行后台进程

ios - 加载远程数据的最佳方式

go - 从 Golang 执行 web2exe 给我 'exit status 2'

GitLab CI 中的 SSH 主机 key 验证失败

python - 如何快速检查 SimpleXMLRPCServer 服务器是否在线?

linux - 每个应用程序是否都实现了自己的网络堆栈?