Search code examples
pythonlinuxsshparamikoxterm

How to connect to a linux server only support xterm terminal


I want to ssh to a server with paramiko modules, but when I do this, Get the server respons like: Error:only support xterm terminal enter image description here

Connect code:

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

How can I set the terminal type? My evn: OS:windows 7 IDE:pycharm python version:3.4


Solution

  • According to this website, you'd need to set the TERM environment variable to 'xterm'.

    However, according to the paramiko documentation, you can tell invoke_shell to emulate a terminal type like so:

    ssh.invoke_shell(term='xterm')