2

I want have a Telnet command inside the ssh command for executing the Telnet command at the remote machine (172.202.230.22). I tried with the command

ssh Administrator@172.202.230.22 telnet 10.86.114.10 8088

It is giving an error message like

command not found (error code:127),

But when I tried to execute the same Telnet command directly at 172.202.230.22 it is executing fine. What is the reason?

Peter Mortensen
  • 2,319
  • 5
  • 23
  • 24
kishore
  • 21
  • 5
  • Which ssh server are you running on 172.202.230.22? – quanta Sep 05 '11 at 18:02
  • It looks like you are Cygwin. Are you trying to invoke the windows version of telnet or the cygwin version (I assume there must be one). – Rilindo Sep 06 '11 at 03:02

2 Answers2

5

Specify the full path to telnet:

$ ssh Administrator@172.202.230.22 /usr/bin/telnet 10.86.114.10 8088 
EEAA
  • 108,414
  • 18
  • 172
  • 242
1

Because of you are connecting as Administrator user, so I think 172.202.230.22 is a Windows server.

Make sure that you have C:\WINDOWS\system32 in your PATH:

$ ssh Administrator@172.202.230.22 path
PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem

If not, try to use the full path to the telnet.exe:

$ ssh Administrator@172.202.230.22 '"C:\WINDOWS\system32\telnet.exe" 10.86.114.10 8088'
quanta
  • 50,327
  • 19
  • 152
  • 213