Improved ssh-agent handling.

This commit is contained in:
2020-03-01 08:05:19 +13:00
parent 1369a8690b
commit b9c99567cc

10
.bashrc
View File

@ -62,8 +62,14 @@ color_my_prompt
# Start from home folder
cd ~/
# Start ssh-agent
eval `ssh-agent`
# Configure ssh-agent
if [ -z "$(pgrep ssh-agent)" ]; then
rm -rf /tmp/ssh-*
eval $(ssh-agent -s) > /dev/null
else
export SSH_AGENT_PID=$(pgrep ssh-agent)
export SSH_AUTH_SOCK=$(find /tmp/ssh-* -name agent.*)
fi
# Remove bitwarden sessions older than a day
if [[ $(find ~/.bw_session -mtime +1 -print) ]]; then rm ~/.bw_session; fi