diff options
Diffstat (limited to 'kshrc')
| -rw-r--r-- | kshrc | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -1,4 +1,4 @@ -# Copyright 2024 Mitchell Riedstra +# Copyright 2025 Mitchell Riedstra # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -314,6 +314,23 @@ sshSetAskpass() { export SSH_ASKPASS_REQUIRE=force } +checkSSHAgentForward() { + if ! [ -d "$HOME"/.ssh ] ; then + mkdir -p "$HOME"/.ssh + chmod 600 "$HOME"/.ssh + fi + + if [ -z "$SSH_AGENT_PID" ] \ + && [ -n "$SSH_CONNECTION" ] \ + && [ -z "$TMUX" ] ; then + + echo "SSH_AUTH_SOCK=\"$SSH_AUTH_SOCK\"; export SSH_AUTH_SOCK" \ + > "$HOME"/.ssh/agent + elif [ -n "$TMUX" ]; then + . "$HOME"/.ssh/agent + fi +} + #shellcheck disable=SC2120 checkSSHAgent() { if [ "$1" = "-k" ] ; then |
