大网数据广告活动
服务器运维问答

emulate telnet over ssh

· 52CE 我爱测

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 t…

问题原文

原帖链接 · 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 user user;
  • 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

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-05-19)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。