I have this structure:

client ---> server(debian) ----> target

target is a telnet server.

I'm able to SSH from client to server and then execute telnet to reach target.

How can I configure server (not client), to, as soon the SSH connection is made, open telnet and leave as soon it closes?

From client I know I can use ssh user@server_ip "telnet target_ip", but I don't have control over client and I don't want eventual clients having any other access to server besides telneting target.

Is this possible?


Sure, you may change shell for the user from bash/tcsh/etc to some script which does the telnet.

go to /etc/passwd, find the user and edit the shell at the end of the line to /usr/bin/yourshell, which can be something like this:

telnet target_ip

then do 'chmod +x /usr/bin/yourshell' and you are good to go.

The user will automatically log off from ssh, as soon as he exits telnet session.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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