Created
October 29, 2019 02:37
-
-
Save maxwellb/0b0e29f829923c6a03c52873c84ebba6 to your computer and use it in GitHub Desktop.
bashrc snippet - ssh-agent.service
This file contains 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
# User mode service for ssh-agent -- set the environment variables | |
SSH_AGENT_PID=$(systemctl --user show ssh-agent.service | grep ^MainPID= | cut -d= -f2) | |
if [ "0" = "${SSH_AGENT_PID}" ]; then | |
systemctl --user restart ssh-agent.service | |
SSH_AGENT_PID=$(systemctl --user show ssh-agent.service | grep ^MainPID= | cut -d= -f2) | |
fi | |
export SSH_AGENT_PID | |
export SSH_AUTH_SOCK="/run/user/$(id -u)/openssh_agent" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment