Disconnecting a telnet session

How can I disconnect an existing telnet session? The host is a serial port server with multiple ports. The users login using the host's name and a port, i.e. telnet host01 1235.

Thanks.

usually

^]   ( ctrl + ] )
close

Yep "Control-]" will take you to a "telnet>" prompt, at which you can type the quit command "q".

For some reason, my previous posts are not showing up on this thread. I tried three times.

That's not what I'm looking for. That only works if I'm have the terminal with the telnet session in front of me. Specifically, I want to use write a script that disconnects an existing telnet session. The telnet sessions do not require user names and passwords; anyone can login by telneting into a host and port number. I do not know from what host the user may be logging from. For example, a user may working be on machine M may log into host H on port P by entering "telnet H P". I may be on machine M2, but I won't know where the other host is logged from, but I do know what host and port the user is logged into because I can't connect to the host-port
I've tried using pexpect to try sending some escape characters into a telnet stream, but I can't even login to the host-port because someone else is already on it.

For some reason, I was not able to post since this afternoon. I tried three times.

That's not what I'm looking for. That only works if I'm have the terminal with the telnet session in front of me. Specifically, I want to use write a script that disconnects an existing telnet session. The telnet sessions do not require user names and passwords; anyone can login by telneting into a host and port number. I do not know from what host the user may be logging from. For example, a user may working be on machine M may log into host H on port P by entering "telnet H P". I may be on machine M2, but I won't know where the other host is logged from, but I do know what host and port the user is logged into because I can't connect to the host-port
I've tried using pexpect to try sending some escape characters into a telnet stream, but I can't even login to the host-port because someone else is already on it.

You mean you want till kill somebody elses telnet session when

(a) you can't actually log into the server; and

(b) you can't log into the client machine the user is telnet'ing from?

You can find their shell process using the "ps" command an kill it.
You need to be root to kill another person's process.

I afraid if situation will be as you described I mean :

  • you HOST A -> trying to log in on some HOST & POST
  • someone else earlier had connected to the same HOST & PORT

and you have not access to this HOST or even telnet sessions are not pass through terminal server there is not exist any way to kill someone's session

Set up an alternate login method on the server (eg ssh), or adjust the program listening for telnets to fork off each time it recieves a connection.

Are you trying to be polite?

:smiley: heh heh heh

I assume in this case we are deailing with a terminal concentrator of some kind. Usually they have an admin option available to disconnect/reset a connection on a given port. We have ~100 terminal concentrators here and they all ( several different brands ) have this option.

Just to clear up any confusion, the "hosts" the users log into are port servers.
The reason I say I am asking this is because most users connect to a host-port but they forget about disconnecting even though they are done using the host-port. There's a GUI application to disconnect a user, but accessing that is very slow. The GUI app is written in TCL, so I'm trying to decipher it. But it seems that I won't be able to write such a script because the it appears only application has permission to disconnect users.
Our old port servers had user names and passwords that were common and everybody knew about them, and anyone could go and disconnect a user. But now the port servers are located somewhere else and no one knows the login info.
Thanks for all the feedback.

At least you will then know the mechanism that it uses. Is it a "set-uid" program? (eg do "ls -ld path-to-program").

Maybe. I'll check on that tomorrow.