diff options
author | Case Duckworth | 2022-01-02 10:01:49 -0600 |
---|---|---|
committer | Case Duckworth | 2022-01-02 10:01:49 -0600 |
commit | 609acec16e6a7867b4bcf507096b767fab8a14dd (patch) | |
tree | e15874d8b4915999b02f67ad0542500c3b7bdee4 | |
parent | Add sh-mode line (diff) | |
download | etc-609acec16e6a7867b4bcf507096b767fab8a14dd.tar.gz etc-609acec16e6a7867b4bcf507096b767fab8a14dd.zip |
Use keychain(1) if available
I need to add this to an install list
-rw-r--r-- | profile/ssh-agent.sh | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/profile/ssh-agent.sh b/profile/ssh-agent.sh index 54d5cf5..8e478c2 100644 --- a/profile/ssh-agent.sh +++ b/profile/ssh-agent.sh | |||
@@ -1,3 +1,10 @@ | |||
1 | # start the ssh-agent | 1 | # start the ssh-agent |
2 | 2 | ||
3 | eval $(ssh-agent -s) | 3 | # use keychain(1), if available |
4 | if type keychain > /dev/null 2>&1; then | ||
5 | # Save directory name in a variable (for ease of maintenance) | ||
6 | export KEYCHAIN_HOME="$HOME/.keychain" | ||
7 | eval $(keychain --eval --dir "$KEYCHAIN_HOME" --agents ssh) | ||
8 | else | ||
9 | eval $(ssh-agent -s) | ||
10 | fi | ||