As a seasoned Linux user, I’ve assembled numerous systemd
Daemons, which I have merely explored this morning through experimentation with… launchctl
. I’ve upgraded my replacement for Sequoia, which means I now need to run it manually. ssh-add
after each boot. Since having to work from a terminal session disrupts other workflows I’ve arranged, I’ll have to save this task for later. ~/.config/scripts/add-ssh-keys.sh
:
#!/bin/bash # Verifying SSH Agent and Adding Personalized Key if [ ! $(pgrep -f ssh-agent) ]; then ssh-add -l > /dev/null 2>&1; then eval "$(ssh-agent -s)" fi # Add the personal SSH key to the agent ssh-add -Okay ~/.ssh/my_private_key
You can easily confirm whether the information you have gathered from various sources accurately reflects the current state of affairs. ssh-add
The command works as written above when entered manually into the terminal? A fast ls
Is confirmed to be executable. Subsequently, I have the next thing saved as a priority. ~/Library/LaunchAgents/com.person.addsshkeys.plist
:
<?xml model="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist model="1.0"> <dict> <key>Label</key> <string>com.person.addsshkeys</string> <key>ProgramArguments</key> <array> <string>/bin/bash</string> <string>/Customers/myusername/.config/scripts/add-ssh-keys.sh</string> </array> <key>RunAtLoad</key> <true/> <key>KeepAlive</key> <true/> </dict> </plist>
I then ran launchctl load -w ~/Library/LaunchAgents/com.person.addsshkeys.plist
and restarted my laptop. I run ssh-add -l
What happens when an agent has no identities? If I run launchctl listing | grep com.person.addsshkeys
The service enjoys a reputation for 2
. If I run log present --predicate '(eventMessage contains["addsshkeys"])' --info
I notice numerous messages alongside faint digital footprints:
xpcproxy: Launch constraint set on 00000000-0000-0000-0000-000000000000 /Customers/myusername/Library/LaunchAgents/com.person.addsshkeys.plist; launchd: [gui/### [######]:] Service inactive: com.person.addsshkeys
What am I lacking?