diff options
| author | Ahmed Abdelhalim <[email protected]> | 2025-11-08 04:09:40 +0100 |
|---|---|---|
| committer | Ahmed Abdelhalim <[email protected]> | 2025-11-08 15:25:17 +0100 |
| commit | cecf1905fe2dc827ae66955161415bd2a5ae34f4 (patch) | |
| tree | d381789faed72327baa8c7cd8259bafcb38ee1cb | |
| parent | 77269b5d2dbbb80499ed8d1adbee37e8752418a2 (diff) | |
Fix forwarding smartcard agent over ssh
| -rw-r--r-- | .bash_profile | 7 | ||||
| -rw-r--r-- | .ssh/config | 1 |
2 files changed, 8 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 diff --git a/.ssh/config b/.ssh/config index 9c118da..465e887 100644 --- a/.ssh/config +++ b/.ssh/config @@ -10,6 +10,7 @@ Host *.local Port 39901 ForwardAgent yes StreamLocalBindUnlink yes + RemoteForward /run/user/1000/gnupg/S.gpg-agent %d/.gnupg/S.gpg-agent # ssh -v kex: algorithm: [email protected] # post-quantum algorithm hangs and fails to exchange keys on ubuntu. |
