Last active
June 1, 2025 22:04
-
-
Save echo-dave/0d1ee6951c4e3bf00d738e84868e7d59 to your computer and use it in GitHub Desktop.
Revisions
-
echo-dave revised this gist
Oct 30, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ If you haven't done so already you can use the well written [gub hub](https://he Note that you may need to use `ssh-add --apple-use-keychain` in Big Sur onward instead of `ssh-add -K`. I discovered the issue in Montery after skipping Big Sur. ## Manual reloading SSH keys The manual method (assuming your keys were stored into the Mac OS Keychain) is to open up Terminal and use Prior to Big Sur: `ssh-add -A` Big Sur and on (discovered the issue with Monterey specifically and skipped Big Sur): -
echo-dave revised this gist
Oct 30, 2021 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,10 +8,10 @@ Note that you may need to use `ssh-add --apple-use-keychain` in Big Sur onward i ## Manual reloading SSH keys The manual method (assuming your keys were stored into the Mac OS Keychain) is to open up Terminal and use Prior to Big Sur: `ssh-add -A` Big Sur and on (discovered the issue with Monterey specifically and skipped Big Sur): `ssh-add --apple-load-keychain` to load all known keys ## Auto load SSH keys after restart - plist file -
echo-dave revised this gist
Oct 30, 2021 . 1 changed file with 7 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,10 +3,15 @@ I'm still not sure what but on both my systems my keys just don't get loaded bac ## Add SSH Keys If you haven't done so already you can use the well written [gub hub](https://help.github.com/en/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) instructions for generating ssh keys. Once you get them generated you'll add them with `ssh-add -K <sshkey>` where sshkey is the file path/name. Keys are stored by default in your ~/.ssh folder ### Update Note that you may need to use `ssh-add --apple-use-keychain` in Big Sur onward instead of `ssh-add -K`. I discovered the issue in Montery after skipping Big Sur. ## Manual reloading SSH keys The manual method (assuming your keys were stored into the Mac OS Keychain) is to open up Terminal and use Prior to Big Sur: `ssh-add -A` Big Sur and on (discovered the issue with Monterey specifically and skipped Big Sur): `ssh-add --apple-load-keychain` to load all known keys ## Auto load SSH keys after restart - plist file -
echo-dave revised this gist
Oct 20, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -42,4 +42,4 @@ ssh-add -A ## Loading as an agent Be sure to make your script executable with `chmod 750 sshadd`. `launchctl load -w ~/Library/LaunchAgents/addssh.plist` -
echo-dave created this gist
Oct 20, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,45 @@ # Help my SSH keys are unavailable after restart I'm still not sure what but on both my systems my keys just don't get loaded back into the ssh-agent on restarts and new login sessions. I got annoyed enough at it that I jumped through the hoops of putting ssh-add into a script and writting a property list file to load as a launchagent to fix it. ## Add SSH Keys If you haven't done so already you can use the well written [gub hub](https://help.github.com/en/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) instructions for generating ssh keys. Once you get them generated you'll add them with `ssh-add -K <sshkey>` where sshkey is the file path/name. Keys are stored by default in your ~/.ssh folder ## Manual reloading SSH keys The manual method (assuming your keys were stored into the Mac OS Keychain) is to open up Terminal and use `ssh-add -A` to load all known keys ## Auto load SSH keys after restart - plist file To automate loading keys we need to write a basic property list file to save to ~/Library/LaunchAgents/ \[addssh.plist\] in my case: ``` <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http$ <plist version="1.0"> <dict> <key>Label</key> <string>addssh</string> <key>Program</key> <string>/Users/YOURNAME/Library/Scripts/sshadd</string> <key>RunAtLoad</key> <true/> <key>KeepAlive</key> <false/> <key>StandardErrorPath</key> <string>/var/log/addssh/addssh.log</string> <key>StandardOutPath</key> <string>/var/log/addssh/addssh.log</string> </dict> </plist> ``` Noteably you'll need to change YOURNAME to your home directory name and also either make the log folder or remove the logging lines. If it can't write the log files due to missing folder or permissions it won't load the keys and fail silently. ## The script I couldn't get it to work without putting ssh-add it into a script which looks like the below. Make sure it goes into your ~/Library/scripts directory or change the reference above. ``` #!/bin/bash ssh-add -A ``` ## Loading as an agent Be sure to make your script executable with `chmod 750 sshadd`. `launchctl load -w ~/Library/LaunchAgents/addssh.plist