Skip to content
Advertisement

How to ssh.invoke_shell() work under Linux

JavaScript

The problem is that in theory the var channel_data must have and print This:

JavaScript

Inted of that, it print this:

JavaScript

The host “xxxx@yyyyy~$” it never appeared, so the part of the code when I asked for:

JavaScript

It never happened.

The only difference from this, to the paramiko librarie example I saw, was that the code work on Windows.

So the quiestión is, what’s the difference between win and Linux at this point?

Why the S.O. do not show the host xxxx@yyyyy~$ ?

Any sugggestión?

Advertisement

Answer

I found the answer:

channel_bytes = channel.recv(9999)

channel_data = channel_bytes.decode(“utf-8”)

Otherwise, people will run into is using bytes (from a buffer) as strings.

Thanks guys !!

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement