python - 如何连接到只支持 xterm 终端的 linux 服务器

标签 python linux ssh paramiko xterm

我想通过 paramiko 模块连接到服务器,但是当我这样做时,得到的服务器响应如下: 错误:只支持 xterm 终端 enter image description here

连接代码:

ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(hostname=blip,username=bluser,password=blpasswd)
channel = ssh.invoke_shell()

如何设置终端类型? 我的晚上: 操作系统:Windows 7 集成开发环境:pycharm python 版本:3.4

最佳答案

根据 this website ,您需要将 TERM 环境变量设置为“xterm”。

然而,根据paramiko documentation ,您可以告诉 invoke_shell 模拟这样的终端类型:

ssh.invoke_shell(term='xterm')    

关于python - 如何连接到只支持 xterm 终端的 linux 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40281490/

相关文章:

shell - pexpect - 通过 ssh 运行 script.sh

Python <p = Popen( ["command"], stdout=PIPE)> 当 p.stdout.read(-1) 被阻止时

python - 我想弄清楚如何将 dbus 与 pidgin 一起使用

python - 如何使用 pybind11 绑定(bind)一个以 numpy.array() 作为参数的函数,例如形状 (10, 10, 3)?

php - Web本地应用程序Apache:运行Shell脚本

ftp - 有没有办法将文件同步到未安装 rsync 的远程位置?

python - 此代码如何计算 4 的 <exponent> 次方

linux - 返回包含指定字符串的全局变量列表的脚本

linux - 如何使用来自外部服务器 linux 的数据启动本地程序

mysql - "Can' t 使用 SSH 隧道连接到本地 MySQL 服务器