Use own instance of ssh-agent when starting a new Xsession

This commit is contained in:
Daniel - 2022-02-26 16:33:41 +01:00
parent d813267061
commit 9f383c9cf3
No known key found for this signature in database
GPG Key ID: 1C7071A75BB72D64
1 changed files with 15 additions and 1 deletions

16
xsessionrc Normal file → Executable file
View File

@ -1,3 +1,17 @@
#!/bin/sh
. $HOME/.profile
. "$HOME/.profile"
# Xsession will start it's own versio nof ssh-agent, but we want to use ours;
# setting SSH_AUTH_AUTH will prevent Xsession from starting it's own instance of
# ssh-agent.
systemctl --user start ssh-agent.service
SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket" # can this be retrieved
# directly from
# ssh-agent.service?
export SSH_AUTH_SOCK
SSH_AGENT_PID="$(systemctl --user show -p MainPID --value ssh-agent)"
export SSH_AGENT_PID