Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • launchd on OS X is set to start ssh-agent when a Unix socket is accessed (and the SSH_AUTH_SOCK variable is prepopulated with the path...) (like inetd, but a Unix socket). This seems possible with systemd as well. (Whether a system-wide service is an option for a per-user service might be interesting to see....) Commented Feb 26, 2018 at 10:49
  • I get Failed to execute operation: Process org.freedesktop.systemd1 exited with status 1 when I run systemctl --user enable ssh-agent on centos7 Commented Mar 18, 2019 at 8:51
  • 2
    You can make ssh-agent exit after your last session by adding After=systemd-user-sessions.service user-runtime-dir@%i.service dbus.service and Requires=user-runtime-dir@%i.service to the [Unit] section. Commented Apr 18, 2021 at 11:48
  • @AlecMev Environment seems to be useful for other services started with systemd that might want to know SSH_AUTH_SOCK. Commented Apr 30, 2021 at 20:55
  • This setup persists through reSTART in Arch (i.e., logout/login, or i3 $mod <Shift> e ). It does not survive a reboot or a 'Reddit-tier IT Support stock answer' (i.e., "Turn it off then back on"). Commented Apr 23, 2023 at 5:36