summaryrefslogtreecommitdiffstats
path: root/.bash_profile
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2025-11-08 04:09:40 +0100
committerAhmed Abdelhalim <[email protected]>2025-11-08 15:25:17 +0100
commitcecf1905fe2dc827ae66955161415bd2a5ae34f4 (patch)
treed381789faed72327baa8c7cd8259bafcb38ee1cb /.bash_profile
parent77269b5d2dbbb80499ed8d1adbee37e8752418a2 (diff)
Fix forwarding smartcard agent over ssh
Diffstat (limited to '.bash_profile')
-rw-r--r--.bash_profile7
1 files changed, 7 insertions, 0 deletions
diff --git a/.bash_profile b/.bash_profile
index 3e575aa..f9b3910 100644
--- a/.bash_profile
+++ b/.bash_profile
@@ -34,6 +34,8 @@ export GREP_OPTIONS="--color=auto"
export PS1="[\h]: \W \$ "
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
+
+# ==== GPG Config
GPG_TTY=$(tty)
export GPG_TTY
unset SSH_AGENT_PID
@@ -42,6 +44,11 @@ if [ -z "$SSH_AUTH_SOCK" ]; then
SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
export SSH_AUTH_SOCK
fi
+# Clean up sockets on logout to avoid gpg warning
+# Warning: remote port forwarding failed for listen path
+if [ -n "$SSH_CONNECTION" ]; then
+ trap 'rm -f /run/user/$(id -u)/gnupg/S.* 2>/dev/null' EXIT
+fi
# ==== Shell Opts
shopt -s checkwinsize # check the window size after each command and, if necessary, update LINES/COLUMNS