0

I'm trying to run ssh command in Eclipse this way

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.

hari
  • 1,297
  • 5
  • 17
  • 36

2 Answers2

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.

Kevin
  • 24,871
  • 19
  • 102
  • 158
0

I can use the in-built method!! Never realized that even existed.

s = exp.spawn(hostName, sshPort, userName, userPassword);
hari
  • 1,297
  • 5
  • 17
  • 36