0

I’ve got the following service to start and stop the ssh-agent. Which I intend to start/enable for –user.

Problem is I get the error message that [email protected] doesn’t exist. But it does. Strangley I can run systemctl status [email protected] but not with the –user flag So to me it seems that [email protected]%i can’t be used on a user-level service.

Am I doing something wrong or anyone an idea how to stop the ssh-agent properly with systemd?

[Unit]
Description=SSH key agent
After=systemd-user-sessions.service [email protected]%i.service dbus.service
[email protected]%i.service

[Service]
Type=simple
Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket
ExecStart=/usr/bin/ssh-agent -D -a $SSH_AUTH_SOCK

[Install]
WantedBy=default.target