I need to add a key to my pre-existing Digital Ocean Droplit that I can use as a single-purpose key inside of a GitHub Action to ssh into the Droplit.
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/chris/.ssh/id_rsa): /Users/chris/.ssh/corgo-bot_rsa
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/chris/.ssh/corgo-bot_rsa.
Your public key has been saved in /Users/chris/.ssh/corgo-bot_rsa.pub.
The key fingerprint is:
The key's randomart image is:
| . o .|
| . SoB . o+|
| . +oXoo o*|
| =+**o.. O.+|
| .+.=*+= +.O.|
| ...+o++ .Eo|
xxx.xx.xx.xx with the ip address of your droplit, we can use
scp to upload our newly generated public key.
scp ~/.ssh/corgo-bot_rsa.pub email@example.com:/opt/corgo-bot_rsa.pub
We then also need to add it to the end of the
~/.ssh/authorized_keys file. We can use this by taking advantage of
>> which will append output to a file.
cat ~/opt/corgo-bot_rsa.pub >> ~/.ssh/authorized_keys
Then we can ssh in and test to make sure the key works
ssh -i ~/.ssh/corgo-bot_rsa firstname.lastname@example.org