So I recently changed laptops, from being a Linux user for the past 2.5 years. I was running Parrot during that time, great os by the way if you are into cyber security stuff or just another full-stack developer like me.
I switch over to Mac, and all my ssh keys were in my previous laptop, they access all of my servers in Digital Ocean and AWS, to cloning and pushing to Github and so much more. I could not convince myself to update all servers with the new ssh keys and I had some issues with Github SSH cloning. So here are the steps I took, enabling me to move all my keys to my new laptop.
- Copy over the ssh keys from your old laptop to the new one, they should be located in the ~/.ssh/ folder. You can use a flash drive or a cloud platform, whatever works for you.
- Paste the files in your new laptop in the same directory.
- Add the to your keychain
# for macos
ssh-add --apple-use-keychain ~/.ssh/id_rsa
# for linux
ssh-add -K ~/.ssh/id_rsa
- The Catch: If you do that you will get an error like this:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0664 for 'id_rsa' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
- To avoid this, run this command;
# this basically makes the keys read-writable by you
chmod 600 id_rsa
- Retry adding it to the keychain
# for macos
ssh-add --apple-use-keychain ~/.ssh/id_rsa
# for linux
ssh-add -K ~/.ssh/id_rsa
- The output should be:
Identity added: id_rsa (<ssh_name_will_appear_here)
Top comments (1)
I got this error still, after running the commands: Bad owner or permissions on /Users/angelotessaro/.ssh/config