4 ms·
I like that with macos, you can create keys with a passphrase, and then that passphrase can be provided by the keychain which is unlocked at login ssh-keygen
by m463 7y ago
I like that with macos, you can create keys with a passphrase, and then that passphrase can be provided by the keychain which is unlocked at login
ssh-keygen -t ed25519 -b 521 -f .ssh/id_foo_ed25519
cat id_foo_ed25519.pub | ssh foo tee -a .ssh/authorized_keys
ssh-add -K ~/.ssh/id_foo_ed25519
along with:
Host foo
HostName foo.bar
User me
StrictHostKeyChecking yes
IdentitiesOnly yes
IdentityFile ~/.ssh/id_foo_ed25519
- LilBytes 7y agoYeah this is a huge time saver.
- terrywang 7y agoIn addition to the traditional | way of adding public key to target hosts, ssh-copy-id [1] is a wrapper script (shipped by most distros, for macOS it is a separate formula) which can be used to batch add a public key target hosts (love to use it prep for Ansible). Put the target hosts in a file e.g. ssh_ducks while read -r i; do ssh-copy-id -i /path/to/ops_ed25519.pub <user>@$i -f; done <ssh_ducks storm (ssh like a boss), it works well when managing (~/.ssh/config) in CLI / scripts but it has an annoying bug [2] (not yet fixed) that will silently convert ssh_config Host keywords to lowercase (luckily ONLY arguments are case sensitive, NOT keywords, otherwise it'll be easier to detect), annoying. Otherwise, for small to medium scale SSH access, I prefer to use jumpserver (open source 4A bastion / remote access gateway) behind VPN (WireGuard of course, for now, self-hosted or Tailscale), a lot easier to deploy in comparison to Teleport, user-friendly UI for average users. [1]: https://github.com/openssh/openssh-portable/blob/master/contrib/ssh-copy-id https://github.com/openssh/openssh-portable/blob/master/cont... [2]: https://github.com/emre/storm/issues/157 https://github.com/emre/storm/issues/157
- ryall 7y agoAnsible can prep a host for Ansible...
- deleted 7y ago[deleted]
- solarized 7y agoPut port there also. Host foo ... Port 2019 So we dont need to specify -P port everytime.
- deleted 7y ago[deleted]
- teekert 7y agoThis sounds really nice, this would be great to have for Linux or wsl...
- Sayrus 7y agoThis is something that you can easily do (at least on Linux) with a keyring and SSH agent (for instance gnome-keyring). I have yet to find an alternative as smooth as TouchID when using a fingerprint reader though.
- messo 7y agoIsn't this default behavior in Gnome? At least when using Fedora, Ubuntu or the more integrated distros. I'm pretty sure I used the fingerprint reader to access SSH with one of my keys on Fedora a few years back.
- oehtXRwMkIs 7y agoHave you never used a keyring in Linux?
- Piskvorrr 7y agoPretty sure I've been using this on various Ubunta for years... edit: yup, it's there. It's so inobtrusive that I had to check explicitly.
- idoubtit 7y agoSimpler than sending a cat into a tunnel: ssh-copy-id -i id_foo_ed25519.pub foo@bar
- terrywang 7y agoEd25519 keys have a fixed length and the -b flag will be ignored [1], it works for ECDSA though, 521 is the largest ec size supported. [1]: https://man.openbsd.org/ssh-keygen.1 https://man.openbsd.org/ssh-keygen.1
- TheFlyingFish 7y agoThe Windows port of OpenSSH does this too, now. It backs its version of ssh-agent with the windows credential store so that you don't have to type any more passwords after you login.
- tzs 7y agoYou can simplify the ssh-keygen command slightly. According to the man page -b is ignored for Ed25519 keys.