Live data from Hacker News

Closing a stale SSH connection

davidisaksson.dev

51–60 of 91 posts

Re: Closing a stale SSH connection

#51

Earlier quoted context omitted.

Another note for nordic layouts and Linux: tilde (~) is considered to be a "dead key" on most nordic layouts, meaning you may need to follow AltGr + ~ with a space before typing out the dot. Otherwise you might get weird looks from the terminal trying to figure what you meant with the tilde-dot. Incidentally, while testing on Windows (in both WSL and cmd.exe) with a Finnish layout: you do not need a space after typin…

~ is also the (very common) shorthand for home directory. How do Nordic keyboard users deal with that?

With agony. It sucks.

Re: Closing a stale SSH connection

#52
post #34

One caveat here is the note: > (Note that escapes are only recognized immediately after newline.) This means that it is easy to pick up a habit to smash the enter-button a few times before doing this dance, and as noted on a nordic layout it can be a bit tricky and since you might seldom do it you might do it a few times. Problem can be that sometimes the connection is only broken one way, what you are typing goes to…

Another note for nordic layouts and Linux: tilde (~) is considered to be a "dead key" on most nordic layouts, meaning you may need to follow AltGr + ~ with a space before typing out the dot. Otherwise you might get weird looks from the terminal trying to figure what you meant with the tilde-dot. Incidentally, while testing on Windows (in both WSL and cmd.exe) with a Finnish layout: you do not need a space after typin…

For this reason you can change the tilde with `EscapeChar` configuration in your `~/.ssh/config` (or `-e` option, but I bet you want it to be permanent).

Re: Closing a stale SSH connection

#53

Pretty sure the answer is no, cause I've been searching for a way to do this for a while, but is there any way to trigger these escapes from script? Use case is bouncing through to an RDS that only allows access from specific EC2 instances. The RDS endpoint in question is highly specific to the EC2 - not a big deal to hit ~L and create the forward manually, but doing this automatically would be great.

Can you not use SSH proxyjump? https://www.redhat.com/sysadmin/ssh-proxy-bastion-proxyjump

Yup. Though doesn't help much for my use case (I don't think) - I have an ever change set of ec2's, each with access to a single RDS endpoint.

Most debug/config is done via sqlcl which is straight forward as that's run from the ec2 and so has access to the DB, but sometimes I need to fall back to eg TOAD or sqldeveloper which require the forward to be setup - either adhoc via ~L or -L or via .ssh/config

Each ec2 knows it's RDS end point and I have an extracted list which I use to generate a list of .ssh/config entries periodically to automatically set up the forwards, but just being able to run a command from the ec2s that translates to eg:

~L > 1521:would make my life marginally easier

Re: Closing a stale SSH connection

#56

Earlier quoted context omitted.

Another note for nordic layouts and Linux: tilde (~) is considered to be a "dead key" on most nordic layouts, meaning you may need to follow AltGr + ~ with a space before typing out the dot. Otherwise you might get weird looks from the terminal trying to figure what you meant with the tilde-dot. Incidentally, while testing on Windows (in both WSL and cmd.exe) with a Finnish layout: you do not need a space after typin…

~ is also the (very common) shorthand for home directory. How do Nordic keyboard users deal with that?

As a former user of ISO layout keyboards, IMHO a great quality of life improvement is to switch to ANSI.

A US ANSI keyboard has all programming symbols in the right place. Yet it makes Latin/Nordic and other symbols easy to type via compose key (e.g. Right Alt), or similar.

For example, Compose a + ' = á, a + e = æ, o + / = ø, s + s = ß, s + o = §, etc.

An annoying issue is that most brands won't sell ANSI keyboards abroad. Apple is one of the few that get this right. A trick is to import from countries where ANSI is the default, such as NL.

Re: Closing a stale SSH connection

#58

Earlier quoted context omitted.

Well... terminal emulators. Bonus points to everyone who has an actual VT240 on their physical desktop.

> Bonus points to everyone who has an actual VT240 on their physical desktop. Bonus points to anyone who can find one and get it to work. I want one, but it's a huge investment (both in price and effort)

The MAME emulator will actually run a VT260 rom, allowing the emulated serial port to be output to a socket.

Re: Closing a stale SSH connection

#59
Due to my use of the ControlMaster feature, I usually just do `ssh -O exit foo` in another terminal to close an existing connection. Either that or just close the terminal and open a new one.

Re: Closing a stale SSH connection

#60

Earlier quoted context omitted.

I suspect many linux users nowadays don't even know that manpages exist or don't want to use them. Otherwise blogposts like this would not exist.

They know the man pages exist and they want to use them, but most are written to merely be consistent in format and not necessarily in content. The worst thing to omit is examples. What users do nowadays is rely on alternatives such as https://tldr.inbrowser.app/

This is my experience with manpages, they're great if you sort of know what you need or want deep CLI options reference but often lack in recipes or examples.
Post reply on HN