Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
Which ssh server are you running on 172.202.230.22? –  quanta Sep 5 '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 6 '11 at 3:02
add comment

2 Answers

Specify the full path to telnet:

$ ssh Administrator@172.202.230.22 /usr/bin/telnet 10.86.114.10 8088 
share|improve this answer
    
also try nesting the command in single or double quotes, as I think ssh parses the arguments in a space separated list. –  mbrownnyc Sep 2 '11 at 19:34
    
Putting the command into quotes is unnecessary. –  MikeyB Sep 2 '11 at 19:53
    
Thanks for you response and i tried with the above specified two methods but still it is not working... :( –  kishore Sep 3 '11 at 8:27
    
What did you get? –  quanta Sep 3 '11 at 15:25
    
even is it not atall giving any error message it is just simply comming to command prompt with %errorlevel% =-1 –  kishore Sep 5 '11 at 14:56
add comment

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'
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.