我想获取一些已写入脚本以供许多用户使用的登录信息。在 python 中,我将 input_raw 设置为从 dev/tty 读取,但是当我通过 ssh 连接到服务器上运行的脚本时,它会严重失败。
想法?解决方法?
我希望避免将用户名硬编码到脚本中。
谢谢,麻烦您了。
尝试使用-t
ssh 选项:
-t Force pseudo-tty allocation. This can be used to execute arbi-
trary 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.
似乎没有等效的选项~/.ssh/config
,因此您需要创建一个 shell 脚本。一个简单的就是:
#!/bin/sh
ssh -t "$*"
将此另存为ssh-t
或者其他的东西,chmod +x ssh-t
,然后把它放在你的某个地方PATH
。然后设置GIT_SSH=ssh-t
告诉 Git 使用这个脚本。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)