You are not logged in.
I tried successfully to store my ssh-key passwords in kwallet with ksshaskpass like described in the arch wiki Using the KDE Wallet to store ssh key passphrases
I realized that I have to start the ssh-agent in plasma before. I did this like described in the arch wiki Start ssh-agent with systemd user.
But the weird thing is when on login my ssh-add.sh autostart script it's not possible to add my ssh keys to the ssh-agent. Instead I get the following stderr output
Could not open a connection to your authentication agent.
I checked that the autostart script really runs at login which is does.
I checked that the ssh-agent process is really running when the script runs with checking
ps -ef | grep "[s]sh-agent"
, which it does.
I checked that the script is running as me $USER.
I added a
sleep 2s
in the script before it runs
ssh-add
command to prevent a race condition.
But i really don't get why I get the stderr output
Could not open a connection to your authentication agent.
When I run the script manually after login it works like it should.
Hope somebody can help me out here.
Kind regards john-soda
Last edited by john-soda (2021-08-11 06:47:55)
Offline
It cam an idea to my mind. I think it has to do with this line which I export in my .zshrc file
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"
When I source my .zshrc file in the autostart script, too. It works like it should.
Maybe I can only add the export line and not source the whole zshrc. Have to test this.
And I think I (or somebody never edited the arch wiki) have to update the documentation about this. in Start ssh-agent with systemd user
Last edited by john-soda (2021-08-10 07:46:12)
Offline
export this line in the autostart script works.
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"
I think it should be explicitly mentiond in the wiki when you run a start script for kde wallet you have to add this export line in the autostart script.
here Using the KDE Wallet to store ssh key passphrases
and here Start ssh-agent with systemd user.
Offline
I think it has to do with this line which I export in my .zshrc file
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"
Correct. https://wiki.archlinux.org/title/SSH_ke … stemd_user says
export the environment variable SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket" in your login shell initialization file, such as ~/.bash_profile.
~/.zshrc is a configuration file for the interactive shell. Login managers such as SDDM don't source it, but they do source ~/.zprofile and ~/.zlogin.
You should instead place the export command in a configuration file for the login shell, i.e. ~/.zprofile.
Offline
Thanks so much for this valuable information, I did not know that!!!
I never heard or saw ~/.zprofile.
Maybe it would be helpful for other people like me, to make the wiki in this case a bit more dummy proof.
I mark this now as solved!
Offline
Sorry If I go back to this issue,
I seem to understand that there's an AUR package, plasma-workspace-agent-ssh, which automatically starts the ssh-agent and sets SSH_AUTH_SOCK.
For example, after installing the AUR package and login into the Plasma session, I get
> echo $SSH_AUTH_SOCK
/tmp/ssh-XXXXXXmqt4LI/agent.94605
Then, following the instructions found here https://wiki.archlinux.org/title/KDE_Wa … assphrases makes everything work.
For example
~/.config/autostart/ssh-add.desktop
[Desktop Entry]
Exec=ssh-add -q
Name=ssh-add
Type=Application
~/.config/plasma-workspace/env/askpass.sh (made executable)
#!/bin/sh
export SSH_ASKPASS='/usr/bin/ksshaskpass'
With these two files, upon logging into the Plasma session, Kwallet asks for the password for the ssh key.
Offline