开发者

Pseudo TTY line limited to 256 characters?

开发者 https://www.devze.com 2023-02-20 21:14 出处:网络
A SSH connection is opened with Plink (PuTTY) from a windows machine to a solaris server via: Plink.exe -t <hostname> /bin/bash

A SSH connection is opened with Plink (PuTTY) from a windows machine to a solaris server via:

Plink.exe -t <hostname> /bin/bash

Then a bash command line is written to stdin of Plink.exe and is parsed and executed by the remote /bin/bash process.

It is working as long as the bash command line is no longer than about 256 characters. After 256 characters have been written, no more characters are echoed back and instead a BEEP (ASCII code 7) is returned for each additional character.

(It may seem strange to use /bin/bash instead of calling a script directly, but this is a simplified ex开发者_JS百科ample of a more complex scenario)

The 256 character limit does only seem to occur if the -t flag is used, but the commands that are executed on the solaris server require a TTY.

The Plink.exe process is started from a JVM on the windows machine.

I tried loading Plink.exe with a PuTTY session configuration with "Local line editing" and "Local echo" both turned off, but the behavior was the same.

Is the limitation of 256 characters in the SSH client (Plink.exe) or on the server side (Solaris, OpenSSH, Bash)?

How can the 256 character limitation be avoided?


Input to a TTY in canonical mode are read line by line, and a very large line may not fit into the input queue. By setting the TTY in raw mode, each character can be read directly and lines can be larger than the input queue.

The problem was solved by calling: "stty raw".

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号