You are not logged in.

#1 2022-10-07 20:04:20

Sapiens
Member
Registered: 2021-07-05
Posts: 52

[SOLVED] Userage of ssh-agent to automatically unlock key

I am currently trying to setup ssh-agent so it caches the credentials for my ssh keys.
I followed the instructions in the wiki to start ssh-agent by systemd. I have exported the SSH_AUTH_SOCK variable to .bash_profile and to be sure have sourced the .bash_profile in the .bashrc.

However unfortunately this is not working at all and I have no idea where it goes wrong. ssh is not caching the credentials and ssh-add tells me the following.

Could not open a connection to your authentication agent.

Help is appreciated.

Last edited by Sapiens (2023-01-07 16:38:01)

Offline

#2 2022-10-07 20:27:11

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,268

Re: [SOLVED] Userage of ssh-agent to automatically unlock key

systemctl --user status ssh-agent.service
echo $SSH_AUTH_SOCK
stat $XDG_RUNTIME_DIR/ssh-agent.socket

Offline

#3 2022-10-08 08:02:09

Sapiens
Member
Registered: 2021-07-05
Posts: 52

Re: [SOLVED] Userage of ssh-agent to automatically unlock key

...

Last edited by Sapiens (2023-01-07 16:39:46)

Offline

#4 2022-10-08 08:26:27

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,268

Re: [SOLVED] Userage of ssh-agent to automatically unlock key

Please don't copy out of the pager (it caps lines, the tailing ">")
However

Oct 08 09:58:00 hell ssh-agent[53822]: SSH_AUTH_SOCK=/run/user/1000/ssh-agent.socket

./.

echo $SSH_AUTH_SOCK
/tmp/ssh-XXXXXXqCYd3w/agent.20240

Should be self explanatory. You're NOT exporting SSH_AUTH_SOCK to your shell, so review that.

Offline

#5 2022-10-08 12:55:05

Sapiens
Member
Registered: 2021-07-05
Posts: 52

Re: [SOLVED] Userage of ssh-agent to automatically unlock key

Sorry, my mistake. I did comment the export out before I posted this. I have the export in .bash_profile and .bashrc but get this.

[sapiens]$ echo $SSH_AUTH_SOCK
/run/user/1000/ssh-agent.socket
[sapiens]$ ssh-add ~/.ssh/id_ed25519
Could not open a connection to your authentication agent.

When I open ssh sessions I get prompted for the password every time.

Last edited by Sapiens (2023-01-07 16:40:16)

Offline

#6 2022-10-08 16:01:09

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,268

Re: [SOLVED] Userage of ssh-agent to automatically unlock key

lsof | grep ssh-agent.socket

Though I guess the systemd activation lacks the export of SSH_AGENT_PID, which is not pre-selectable.
How do you start your session?

Offline

#7 2022-10-08 17:53:51

Sapiens
Member
Registered: 2021-07-05
Posts: 52

Re: [SOLVED] Userage of ssh-agent to automatically unlock key

...

Last edited by Sapiens (2023-01-07 16:40:41)

Offline

#8 2022-10-08 20:51:01

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,268

Re: [SOLVED] Userage of ssh-agent to automatically unlock key

P.S. Now I get the reference to session. I use sway and don't use a display manager, I just login and enter "sway" to start the desktop environment.

Why not just use https://wiki.archlinux.org/title/SSH_ke … er_program ?

Offline

#9 2022-10-08 20:55:17

Sapiens
Member
Registered: 2021-07-05
Posts: 52

Re: [SOLVED] Userage of ssh-agent to automatically unlock key

...

Last edited by Sapiens (2023-01-07 16:40:51)

Offline

Board footer

Powered by FluxBB