In online videos I see how to generate an ssh key set in Puttygen and point to my private key in a Putty session, pretty straightforward. But I can’t figure out how to use my private key to connect to a ssh session in Home Assistant on a Mac in the Terminal app. Any assistance with this will be greatly appreciated.
I’m away from a real computer at the moment, so forgive me if my instructions are slightly vague or incomplete.
You can generate a key at a Terminal prompt with ssh-keygen. A typical command to generate a 2048 bit RSA key would look like
ssh-keygen -t rsa -b 2048
Refer to the ssh-keygen man page for more usage instructions. https://linux.die.net/man/1/ssh-keygen
This puts a copy of your public key in .ssh/id_rsa.pub
in your home directory. You can use the scp command to transfer this to your pi with a command like this
scp .ssh/id_rsa.pub pi@{raspi ip address}:
Note the colon after the IP address. That’s important, it tells scp to transfer to a remote machine, otherwise it just creates a local file.
After you have a key created, it’s also worth learning about the ssh-add
command. After typing you key passphrase once, it will be added to your ssh keyring, and you won’t need to enter it again for that session.