I'm trying to run ssh command in Eclipse this way
我试图以这种方式在Eclipse中运行ssh命令
ExpectJ exp = new ExpectJ();
Spawn s = exp.spawn("ssh root@192.168.1.2");
. . .
. . .
. . .
But i get this as the error-
但我得到这个错误 -
Pseudo-terminal will not be allocated because stdin is not a terminal.
If i try doing it the following way,
如果我尝试以下方式,
Spawn s = exp.spawn("ssh -t -t root@192.168.1.2");
and execute,i get this error
并执行,我得到这个错误
tcgetattr: Invalid argument
also,the code executes only half and i get this message-
此外,代码只执行一半,我收到此消息 -
Killed by signal 15.
and finally i face a timeout exception
最后我面临超时异常
Any Suggestions? I'm not sure what those error messages mean.
有什么建议?我不确定这些错误消息是什么意思。
2 个解决方案
#1
0
I'm not sure why you're getting the errors you're seeing, but I can say when I've needed to do ssh/scp etc. I've used this library: http://www.jcraft.com/jsch/ and it's worked very well for me.
我不确定你为什么会遇到你所看到的错误,但我可以说我什么时候需要做ssh / scp等我已经使用过这个库:http://www.jcraft.com/ jsch /它对我来说非常好用。
#2
0
I can use the in-built method!! Never realized that even existed.
我可以使用内置方法!!从来没有意识到甚至存在。
s = exp.spawn(hostName, sshPort, userName, userPassword);
#1
0
I'm not sure why you're getting the errors you're seeing, but I can say when I've needed to do ssh/scp etc. I've used this library: http://www.jcraft.com/jsch/ and it's worked very well for me.
我不确定你为什么会遇到你所看到的错误,但我可以说我什么时候需要做ssh / scp等我已经使用过这个库:http://www.jcraft.com/ jsch /它对我来说非常好用。
#2
0
I can use the in-built method!! Never realized that even existed.
我可以使用内置方法!!从来没有意识到甚至存在。
s = exp.spawn(hostName, sshPort, userName, userPassword);