如何强制“vagrant ssh"进行伪 tty 分配? [英] How can I force `vagrant ssh` to do pseudo-tty allocation?
问题描述
在 vagrant ssh
之后我做的第一件事通常是附加到 tmux
会话.
The first thing I do after vagrant ssh
is usually attaching to a tmux
session.
我想自动化这个,所以我尝试:vagrant ssh -c "tmux attach"
,但它失败并说不是终端".
I want to automate this, so I try: vagrant ssh -c "tmux attach"
, but it fails and says "not a terminal".
经过一些谷歌搜索后,我发现 这篇文章 并且知道我应该在执行基于屏幕的程序之前强制进行伪 tty 分配,并且可以通过 的
.-t
选项来完成ssh
After some googling I find this article and know that I should force a pseudo-tty allocation before executing a screen-based program, and it can be done with the -t
option of ssh
.
但我不知道如何将这个选项与 vagrant ssh
一起使用.
But I don't know how to use this option with vagrant ssh
.
推荐答案
根据 this文档,您应该尝试将 --
添加到命令中.
由于我没有使用 vagrant,我不确定格式,但假设它类似于:
According to this documentation, you should try adding --
to the command.
As I have not used vagrant, I am unsure of the formatting, but assume it would be similar to:
vagrant ssh -- -t
除非您需要包含用户名和主机,在这种情况下添加用户名和主机.
Unless, you need to include the username and host, in which case add the username and host.
这篇关于如何强制“vagrant ssh"进行伪 tty 分配?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!