Hi! systemd won't voluntarily start your ssh-agent as it's socket
activated, meaning some other process must poke on its socket to cause
it to start. On Ubuntu Desktop that's typically the GNOME Keyring daemon
that does it during session startup.

But systemd is ready, listening on the socket, the only problem is that
applications don't know where the socket is. TL;DR You just need to know
where the socket is and export its environment variable (tip: it's under
your user's runtime dir).

Following the commands and outputs below you'll see that:

1. The ssh-agent.service starts inactive.
2. The ssh-agent.socket unit is active, meaning systemd is listening.
3. ssh-add -l fails because it doesn't know where the socket is.
4. After exporting SSH_AUTH_SOCK=/run/user/1000/openssh_agent, ssh-add -l 
"succeeds".
5. Now ssh-agent.service is running.


user@DESKTOP-551PQ9O:~$ systemctl --user status ssh-agent.service
○ ssh-agent.service - OpenSSH Agent
     Loaded: loaded (/usr/lib/systemd/user/ssh-agent.service; static)
     Active: inactive (dead)
TriggeredBy: ● ssh-agent.socket
       Docs: man:ssh-agent(1)
user@DESKTOP-551PQ9O:~$ systemctl --user status ssh-agent.socket
● ssh-agent.socket - OpenSSH Agent socket
     Loaded: loaded (/usr/lib/systemd/user/ssh-agent.socket; enabled; preset: 
enabled)
     Active: active (listening) since Thu 2026-06-11 11:59:06 -03; 3h 8min ago
 Invocation: 57e51ed74de84caea087afcb48329d4e
   Triggers: ● ssh-agent.service
       Docs: man:ssh-agent(1)
     Listen: /run/user/1000/openssh_agent (Stream)
    Process: 369 ExecStartPost=/usr/bin/systemctl --user set-environment 
SSH_AUTH_SOCK=/run/user/1000/openssh_agent (code=exited, status=0/SUCCESS)
      Tasks: 0 (limit: 7087)
     Memory: 4K (peak: 1.7M)
        CPU: 4ms
     CGroup: 
/user.slice/user-1000.slice/[email protected]/app.slice/ssh-agent.socket

Jun 11 11:59:06 DESKTOP-551PQ9O systemd[356]: Starting ssh-agent.socket - 
OpenSSH Agent socket...
Jun 11 11:59:06 DESKTOP-551PQ9O systemd[356]: Listening on ssh-agent.socket - 
OpenSSH Agent socket.
user@DESKTOP-551PQ9O:~$ ssh-add -l
Could not open a connection to your authentication agent.
user@DESKTOP-551PQ9O:~$ export SSH_AUTH_SOCK=/run/user/1000/openssh_agent
user@DESKTOP-551PQ9O:~$ ssh-add -l
The agent has no identities.
user@DESKTOP-551PQ9O:~$ systemctl --user status ssh-agent.service
● ssh-agent.service - OpenSSH Agent
     Loaded: loaded (/usr/lib/systemd/user/ssh-agent.service; static)
     Active: active (running) since Thu 2026-06-11 15:09:00 -03; 6s ago
 Invocation: f13c59ccd9894397b42bcb5119328979
TriggeredBy: ● ssh-agent.socket
       Docs: man:ssh-agent(1)
   Main PID: 652 (ssh-agent)
      Tasks: 1 (limit: 7087)
     Memory: 1.3M (peak: 1.7M)
        CPU: 11ms
     CGroup: 
/user.slice/user-1000.slice/[email protected]/app.slice/ssh-agent.service
             └─652 /usr/bin/ssh-agent -D

Jun 11 15:09:00 DESKTOP-551PQ9O systemd[356]: Started ssh-agent.service - 
OpenSSH Agent.
user@DESKTOP-551PQ9O:~$

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2156041

Title:
  (noble) ssh-agent not started in WSL

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/openssh/+bug/2156041/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to