Hacker News new | ask | show | jobs
by 0xbadcafebee 106 days ago
Find the HIDDEN SECRETS that THEY DON'T WANT YOU TO KNOW!

    $ man ssh
13 comments

Many Linux man pages have the thoroughness of a fortune cookie, so I can understand the skepticism.

Jackpot if they're just a pointer to an 'info' page.

Most people just discount man pages as unreadable and don’t even try to understand them.

Case in point: the jq man page is incredible and everyone I know instead runs off to google or stackoverflow or Claude to answer simple questions

The real jackpot is if they're the same as the --help command
I used to think this and used things like `help2man`. I now disagree, but throwing it out there.
I could use some "help2man." I don't know how to "man" /s
But its also true that many, many man pages have extremely valuable information that no enterprising hacker should overlook, too ..
I was never able to properly parse large man pages, I'm so happy that llms can now prepare half a usable command without spending an hour reading a time without a single usage example.
What I usually do when I have to read large man pages like bash(1) is I read them as PDFs:

man -Tpdf bash | zathura -

Replace zathura with any PDF viewer reading from stdin or just save the PDF. Hope that can be useful to someone!

my manpager is `vim -`, can't beat that
You probably can — by using neovim:

https://wiki.archlinux.org/title/Neovim#Use_as_a_pager

https://neovim.io/doc/user/filetype/#_man

I've also been running (neo)vim as a manpager. You get the same features as with vim (like easily copying text or opening referenced files/other manpages without using the mouse), but neovim also parses the page and creates a table of contents, which can be used for navigation within the page. It doesn't always work perfectly, but is usually better than nothing.

`tldr` is also great. It's essentially a collection of example invocations of *nix commands.
TIL that what I have wanted in manpages for years exists. Thank you!
tldr is so good, i wish it was a part of the os the same way manpages are just to help out newcomers
Do we still have those? I think it was common in late '90s, due to GNU trying to get `info` gain moment but nowadays?
Mostly just the bash builtins have (had) this problem.
I blew a few minds a week ago when I told my younger coworkers about man pages. I hit ‘em with the `man man` and one dude was like “whoa!”
Further blow their minds by showing them `apropos` https://manpages.debian.org/testing/man-db/apropos.1.en.html
I remember my first days with Linux/Unix and being taught about man and apropos and info. But somehow I could never find anything useful via apropos!

With many years of insight, I think I probably never updated the database.

man -k, apropos, but less to type
I'm 100% certain this is user error, but I have not once gotten apropos to give me any output other than "nothing appropriate."
Reminds me of the old canard of 'man woman'
man, cat, lynx... We're all just creatures in a vast universe
$ man -k <whatever>
Who doesn’t want you to know? Well, obviously, the man. That’s why you type man ssh, you’re forcing the man to tell you what he knows.
man ssh_config is even more interesting and hidden

ProxyCommand is fun

You can also run commands when a user authenticates, grab their keys from github.com/username.keys, validate they're a user in a specific github group, then let them connect by outputing the keys, otherwise nothing to deny them access.

It's really great for ops teams where you want to give ssh access and manage it from github teams without needing a complex system.

Honest question, why is ProxyCommand `fun`? What do I get out of ProxyCommand that i do not get out of setting the correct order for ProxyJump and doing an ssh finalhost -- domy --bidding?
ProxyJump is a newer functionality. There used to be only ProxyCommand. ProxyJump is a shortcut for the usual way to use ProxyCommand to connect through a bastion host but ProxyCommand is more flexible. For example with ProxyCommand you can run any command to connect to the remote host. ProxyJump only connects over ssh. I think I replaced all my ProxyCommand with ProxyJump because I don't need much else than the normal use case.
You can get a lot more out of ProxyCommand. For example, you can run SSH over non-IP protocols, such as serial, Bluetooth RFCOMM for embedded boards, or vsock for virtual machines without networking set up at all. The latter is built into and setup up automatically by systemd:

https://www.freedesktop.org/software/systemd/man/257/systemd...

Much appreciated!
ProxyCommand allows you to use any command to setup a connection. Not necessarily an ssh command, like ProxyJump. It can be any command, as long as it receives on stdin and produces on stdout, it can act like a TCP connection.

ProxyJump is a special case of `ProxyCommand ssh -p <port> <user>@<host>`. Can't replace the `ssh` in there when using ProxyJump.

I came across ProxyCommand earlier this week, funnily enough. I have Cloudflare Zero Trust set up with an SSH service[0], and have the server firewall drop all incoming traffic. That helps reduce my attack surface, since I don't have any incoming ports open.

[0]: https://developers.cloudflare.com/cloudflare-one/networks/co...

I use ProxyCommand in edge-case devices where key auth is not an option and the password is not controlled by me. ProxyCommand points to a script the retrieves the password from the vault, puts it on the clipboard for pasting, reminds me via stderr it's done so, and then proxies the connection.
Interesting. I might have such a use case. Do you have anything about best practices on how to automate grabbing passwords from vaults? Cuz it seems to me that the vault needs to be kept open or keep the vault password somewhere on disk.
I use ProxyCommand to run spipe tunnels for SSH.
`pgrep`/`pkill` HATE this trick! Learn how this renegade developer (relatively) easily exits their hanging SSH sessions without restarting their laptop.
Not as much as they hate Enter ~ .

See "escape characters" under man ssh.

Shh, you're giving away the trick for free! Please think of my clickthrough rates and ad revenue.
I still struggle with the fact that I was (or delusional) an effective C programmer "back in the day" (before google etc) and all we had was "man" to look up std/x11 system calls.

Now I am dismayed with juniors who can't even be bothered to use google (or llms) to look up stuff on their first hiccup.

#include <old-man-shouting-at-clouds>

That’s not a builtin, so wouldn’t it be:

   #include <old-man-shouting-at-clouds.h>
And it's kinda old, so maybe

  #define _POSIX_C_SOURCE 1
  #include <old-man-shouting-at-clouds.h>
Well played good sir, well played
HN as a tabloid ... After all enquiring minds want to know!
It’s been a while since I’ve heard RTFM
RTFM gave way to LMGTFY, and I next is something like ATLLM (ask the LLM)
Because it is associated with "toxicity". Yeah, I know.
They're sticking it to the man
Working for the man eh?
sssshhhh...don't just give out secrets like that .
hahaha made me laugh, thanks :-D
How's that supposed to help? The ssh man page is about as close as you can get to a Platonic example of "uninformative pretend-documentation".