问题原文
原帖链接 · Jose L Martinez-Avial · CC BY-SA 4.0
I have a client/server application that work over a telnet connection, and it does not support SSH. Basically the client opens a telnet connection to the server, which starts a specific shell, and the client sends commands over the telnet connection to that shell. The problem is that I need to make this work over a ssh connection, and the remote server does not have telnet services, so I cannot use a tunnel over the ssh connection. I need some kind of telnet emulator that will offer a telnet endpoint to the client, while connecting through ssh to the server. Is there any way to do this?
thanks
已采纳解答
原帖链接 · Sergey Nudnov · CC BY-SA 4.0
That's a normal case for port forwarding over ssh.
A server <ip> has ssh endpoint opened and an application server listening on Telnet port 23.
A client has an application client which should connect to <ip>:23. Also client has nothing listening on port 23.
Let's establish port forwarding from server to client:
ssh -N -L 23:127.0.0.1:23 user@<ip> >/dev/null 2>&1 &
Here we:
- connect to the server
<ip>as useruser; - put ssh session into background;
- redirect ssh session's output into /dev/null to avoid any messages on console;
- forward port 23 from the server's localhost to the client (your application server should listen on all IP interfaces, including 127.0.0.1)
Now application client should connect to the address 127.0.0.1:23 to work with the application server.
Update
As per explanations, we have a telnet only capable client software and ssh only capable server. And client should be able to access the server.
As it happens, such solution does exist. From manual:
SSH/Telnet gateway
In the Telnet-DeleGate (DeleGate server for Telnet clients), a host name prefixed with "-ssh" and "." (as "-ssh.host") implies a SSH server on the host. In access to such a server, Telnet-DeleGate works as a gateway between the SSH server and a Telnet client. For example, using a Telnet-DeleGate configured like follows, Telnet clients can login to a SSH server on host as user as follows:
% delegated -P8023 SERVER=telnet://-ssh % telnet -l user@host localhost 8023
Meet DeleGate
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
