SSH Secret Menu
37 points
22 hours ago
| 5 comments
| twitter.com
| HN
https://xcancel.com/rebane2001/status/2031037389347406054
0xbadcafebee
1 hour ago
[-]
Find the HIDDEN SECRETS that THEY DON'T WANT YOU TO KNOW!

    $ man ssh
reply
smoyer
41 minutes ago
[-]
HN as a tabloid ... After all enquiring minds want to know!
reply
senectus1
32 minutes ago
[-]
hahaha made me laugh, thanks :-D
reply
pram
1 hour ago
[-]
Yep the menu is handy for ssh tunneling. Maybe not a lot of people doing that these days though with stuff like dev tunnels and Tailscale.
reply
MayeulC
47 minutes ago
[-]
I typically just create a "new" connection in a separate tab when I want to add tunneling.

I put new in quotes because I use another little-known feature, "ControlMaster". Multiplexes multiple connections into one, it makes making " new" sessions instant (can also be configured to persist a bit after disconnecting). Also useful for tab-completing remote paths. It does not prompt for authentication again, though. And it's a bit annoying when the connection hands (can be solved with ssh -o close, IIRC).

reply
blueflow
1 hour ago
[-]
As secret as the ssh manual.
reply
_kst_
1 hour ago
[-]
That doesn't do much good if you set `EscapeChar` to `none` in `.ssh/config`.

I find it convenient not to have to worry about accidentally entering escape characters. YMMV.

reply
MayeulC
54 minutes ago
[-]
Note that it only works after pressing enter, so the odds are slim. In practice, I don't think I ever hit it by accident.
reply
greyface-
12 minutes ago
[-]
I have noticed it while running ~/bin/some_command. The ~ doesn't echo until I also type the /. It doesn't cause any misbehavior because there is no binding for ~/ but can be slightly surprising.
reply
wolvoleo
53 minutes ago
[-]
SSH does it pretty well though. Never once have I done it by mistake.
reply
piccirello
1 hour ago
[-]
I've been using SSH for ~15 years and never knew about these escape sequences. I'm eagerly awaiting my next hung session so that I can test `~.`. It's much nicer than my current approach of having to close that terminal window.
reply
lathiat
50 minutes ago
[-]
Have been using that weekly since probably 20 years. Will change your life :)

My other favourite is I very often SSH with -v to figure out why the connection is hanging, you rapidly figure out if DNS is failing, the TCP connection doesn't open, it does open but no traffic flows at all or it opens and SSH negotiation starts but never finishes. You can learn a lot just from this about what is wrong.

reply
TacticalCoder
5 minutes ago
[-]
> It's much nicer than my current approach of having to close that terminal window.

You can also just kill the ssh process (say from another terminal). That way you get to keep your terminal window. And this works with everything "blocking" your terminal, not just ssh.

reply
sirfz
45 minutes ago
[-]
You can even chain them if you have deep ssh connections (i.e. ssh from one instance to another). I think it would be ~~. to terminate the 2nd hop.

Edit: it's already explained in the OP

reply
wolvoleo
55 minutes ago
[-]
I use that every day but it's the only one I know by heart lol
reply
shmerl
1 hour ago
[-]
I've been using ~. on hung ssh connections for a while.
reply