I have run into an issue where I restored my MacBook and lost the SSH private key to my Raspberry Pi, so I can't ssh back into the device. I would like to restore SSH functionality, but when I start my Raspberry Pi and go through the verbose boot screen, it automatically logs in and goes to a blank screen. How do I fix this issue and restore access to my Pi?
Here's what I would do.
Install a Debian or other Linux Virtual Machine on your Mac (VirtualBox is good for this). You'll need this to access the Linux-formatted filesystems on the SDCard.
Shut down the Raspberry Pi and remove the SDCard.
Insert the SDCard into your Mac, and load the VirtualBox VM (and install Linux on it). Then follow the instructions here to solve this exact problem by mounting the SDCard under a Linux VM and editing the
authorized_keys file or
Since you're using a Mac the solution is relatively simple.
Take the SD card out of the Raspberry Pi and put it into your Mac.
Find the file,
/home/pi/.ssh/authorized_keys, on the appropriate partition
Delete the old public keys listed in the file
Add your new public key
Unmount the device from your Mac
Plug it into the RPi and plug it back in
It appears that I'm misinformed of the capabilities of MacOS. Looks like your best option is the same one given to Windows users. Download VirtualBox, and follow the same instructions, but from Linux instead.