SSH_AUTH_SOCK is not set correctly

So I’ve followed the guide here: https://wiki.archlinux.org/index.php/SSH_keys#SSH_agents and searched all over the internet, but I can’t get $SSH_AUTH_SOCK to work without setting him manually in every damn session.

I’ve filled my install with every junk program on the planet, in hopes of making this work, but it just doesn’t. Does anyone have any last suggestions on how to make this work?

My big problem here is that my GUI encrypted volume can’t read the socket, which means it can’t load my key, which means no keys and no SSH.

I know Arch/Manjaro is a diy distro, but not shipping with a working key-agent system, seems as logical as shipping it without passwd?

A little extra info:

Agent pid 1458
[jardie@lobo ~]$ [[ ! "$SSH_AUTH_SOCK" ]] && echo booot
booot
[jardie@lobo ~]$ echo $SSH_AUTH_SOCK

[jardie@lobo ~]$

This is how my console looks, if I remove “> /dev/null”, it clearly runs source correctly, but $SSH_AUTH_SOCK is not set. If I manually run source again, it will attach the agent.

I seem to have figured it out on my own, there were two problems at play here, one is that KDE does NOT run .bashrc for it’s windowed processes, the other was that bash subshells was creating problems.

The Arch guide code has to go into two files to work proper and it has to go into them directly, if you execute another script, the env variables will only be set inside this script, due to subshells methodologies.

The two files the code has to be set in is .xprofile and .bashrc, xprofile makes sure apps can reach the agent and bashrc makes sure shells can reach it.

The arch code, for ease of use:

if ! pgrep -u "$USER" ssh-agent > /dev/null; then
    ssh-agent -t 1h > "$XDG_RUNTIME_DIR/ssh-agent.env"
fi
if [[ ! "$SSH_AUTH_SOCK" ]]; then
    source "$XDG_RUNTIME_DIR/ssh-agent.env" >/dev/null
fi
1 Like

One would think that zsh users would have to apply this to .zshrc - if they run into this.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.