Created
September 10, 2016 13:02
-
-
Save nrbrook/fe7902e1b72c1cc5dbacfea01d48fed0 to your computer and use it in GitHub Desktop.
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 characters
# in ~/Library/LaunchAgents/com.user.addkeyonlogin.plist (replace <path to home>) | |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>com.user.addkeyonlogin</string> | |
<key>Program</key> | |
<string><path to home>/.ssh/addkeyonlogin</string> | |
<key>RunAtLoad</key> | |
<true/> | |
</dict> | |
</plist> | |
# in ~/.ssh/addkeyonlogin (replace /path/to/key and p4ssword) | |
#!/usr/bin/expect | |
eval spawn ssh-add "/path/to/key" | |
#use correct prompt | |
set prompt ":|#|\\\$" | |
interact -o -nobuffer -re $prompt return | |
send "p4ssword\r" | |
interact | |
# run `launchctl load ~/Library/LaunchAgents/com.user.addkeyonlogin.plist` | |
# run `launchctl start com.user.addkeyonlogin` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment