News for hackers. Stuff that matters.
Re:macOS command-line tools you might not know about by agmm on Tuesday June 27, 2023 @10:05AM (#36492953)
I like to use `pbcopy` when exporting public keys to external services like GitHub.

`cat ~/.ssh/mykey.pub | pbcopy`

Re:macOS command-line tools you might not know about by wincy on Tuesday June 27, 2023 @10:35AM (#36493456)
I love this tool too!

except one time I quickly typed

`cat ~/.ssh/mykey | pbcopy`

And sent it straight away to my coworker on Slack.

I then spent the rest of the day making a new private key and adding my new pubkey to all of the 1000+ servers I had root access to. I mean we had tools to help but it still wasn’t fun.

With great power/convenience comes the potential to do dumb things at lightning speeds!

Re:macOS command-line tools you might not know about by oxygen_crisis on Tuesday June 27, 2023 @10:46AM (#36493643)
I might start naming my private key files ~/.ssh/keyname.PRIVATE after hearing that story...
Re:macOS command-line tools you might not know about by plorkyeran on Tuesday June 27, 2023 @11:16AM (#36494083)
That's not a bad idea. I've never actually made the same mistake, but I have caught it at the last moment and having tab complete not pick the private one first would help.
Re:macOS command-line tools you might not know about by wincy on Tuesday June 27, 2023 @11:34AM (#36494368)
It would have avoided it! I was using tab and forgot to select .pub as you correctly surmised. I was a junior dev at the time and all the seniors got a good laugh out of it, and I use it as a cautionary tale about trying to be TOO overeager and efficient.
Re:macOS command-line tools you might not know about by gunapologist99 on Tuesday June 27, 2023 @12:30PM (#36495123)
Userify would have made that pretty painless (all it really seems to do is update the authorized_keys across all of your servers every minute or so)
Re:macOS command-line tools you might not know about by superq on Tuesday June 27, 2023 @04:30PM (#36498233)
also userify allows you to set up sudo access on some of the servers and not others, so that'd take care of the other root-access issue you have. (sudo also provides auditing/logging controls that are useful in a multi-user environment)
Re:macOS command-line tools you might not know about by vinay_ys on Tuesday June 27, 2023 @01:39PM (#36496196)
If you literally have ssh root access to 1000+ servers, using certificates will be more secure and convenient than directly using public key.
Re:macOS command-line tools you might not know about by xrisk on Tuesday June 27, 2023 @02:08PM (#36496552)
put your private key in something like Secretive: https://github.com/maxgoedjen/secretive
Re:macOS command-line tools you might not know about by _rend on Tuesday June 27, 2023 @10:22AM (#36493226)
You can even simplify this further by feeding `pbcopy` the key directly using file redirection instead of a pipe:

`pbcopy < ~/.ssh/mykey.pub`

(I use this all the time myself!)