Hacker News new | past | comments | ask | show | jobs | submit | derpsabert's comments login

One of the many reasons why SSH is superior. Hit ~. and you're out.


For those who don't know about this, that's close, but a newline needs to precede the tilde: See https://linux.die.net/man/1/ssh and use browser find for "Escape Characters". I find this is one of those things that can pleasantly surprise people who have been using SSH for years without knowing about it. (Another one I see a lot is using the "authorized keys" to limit what command can be run with a particular key.)

(Along with the utility of force-closing connections, this is also why it can be surprisingly difficult to use SSH in situations where you want a low-privilege user to be able to access the shell of a remote system, but not immediately get up to crazy network shenanigans. SSH is actually too feature-rich for that use case, and this escape-character menu is an example of why; even if you somehow take control of the command line entirely, they can still start opening reverse forwards and doing a variety of other things. Very useful for reasonably privileged users, though.)


The old rlogin manuals are better than the OpenSSH manual in this regard.

* https://unix.stackexchange.com/a/454228/5132


The tilde character can be surpisingly hard to type on some keyboards as well. I can't even figure out how to do it on my current keyboard because in place of the backtick/tilde key is the escape key. On a norwegian keyboard the tilde character is "dead", meaning you have to press the tilde character followed by spacebar to get it, and that might not work in situations like wanting to exit an SSH session due to... reasons.


The tilde escape predates SSH - it comes from the cu (Call UNIX) program in BSD 4.2:

https://github.com/dspinellis/unix-history-repo/blob/usr/src...


I just use the gold old ^D in an empty prompt.

https://en.wikipedia.org/wiki/End-of-Transmission_character#...


That's how you gracefully shut down an SSH session, with the socket close initiated from the remote end (where the shell is running.)

\n~. is for gracefully exiting a stuck/hung SSH session (e.g. one where the remote isn't responding to input) without force-killing the SSH client itself (which might do bad things to the process group it lives in.)


Unfortunately not all Telnet servers support that.

Being the least interesting programmer on Hacker News, I don't always write code to handle Telnet-compatible ASCII input, but when I do, I always support ^D.


On portuguese keyboards, ~ is a dead key. You have to type ~<space>.<enter> I'm not sure whether that's superior.


Where do you see ~ on the AZERTY keyboard shown in the article?


How is ~. supposed to be superior


You can set the telnet escape character via "telnet -e <char>".


443 and 1194 only make sense for TCP since there's nothing of note that commonly runs on those UDP ports.


443/UDP is used for HTTP/3 (aka QUIC), and is pretty quickly becoming ubiquitous – and OpenVPN also supports UDP, so if the port is open for TCP, it might well also be open for UDP.


For UDP, the OP could try the SIP ports


Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: