From cecf1905fe2dc827ae66955161415bd2a5ae34f4 Mon Sep 17 00:00:00 2001 From: Ahmed Abdelhalim Date: Sat, 8 Nov 2025 04:09:40 +0100 Subject: Fix forwarding smartcard agent over ssh --- .bash_profile | 7 +++++++ 1 file changed, 7 insertions(+) (limited to '.bash_profile') 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 -- cgit v1.2.3