Pseudo terminal to use with ssh in java

柔情痞子 提交于 2019-12-13 04:34:29

问题


I am writing a program to connect to a remote server with ssh and provide the user with a shell terminal.

I've tried JSch and sshj -- both can connect properly but just hooking up the input/output streams of their shell channels to System.in and System.out produces funky output. I know why--the documentations for both JSch and sshj say that they don't have terminal emulation built in so the input/output is ugly. (sshj calls this implementation a "rudimentary PTY")

I also have a selection of terminal emulators: JTerm, DragonConsole, and Terminator.

My goal is to start a terminal emulator window and do something similar to plugging the input/output streams from the shell channel into the emulator.

Alternatives like suggesting a way for me to process input/output to/from the shell channel myself to get rid of the junk characters would be appreciated as well--that's the main problem.

Edit: Here is the sshj "rudimentary PTY"

And here's the JSch version


回答1:


JCTerm has implemented a terminal emulator. Its source code is available at https://github.com/ymnk/jcterm , and you can try its online-demo at http://wiredx.net/jcterm/ .



来源:https://stackoverflow.com/questions/11680753/pseudo-terminal-to-use-with-ssh-in-java

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!