[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#788745: systemd user unit to start ssh-agent



Package: openssh-client
Version: 1:6.7p1-6
Severity: wishlist
Tags: patch

Hi,
I'm using the attached systemd user unit to startup
ssh-agent.

Cheers,
        Moritz
diff -Naur openssh-6.7p1.orig/debian/openssh-client.install openssh-6.7p1/debian/openssh-client.install
--- openssh-6.7p1.orig/debian/openssh-client.install	2015-03-23 00:08:49.000000000 +0100
+++ openssh-6.7p1/debian/openssh-client.install	2015-06-11 11:33:20.443877625 +0200
@@ -35,3 +35,4 @@
 # Upstart user job (only used under user sessions).
 debian/ssh-agent.user-session.upstart => usr/share/upstart/sessions/ssh-agent.conf
 
+debian/ssh-agent.service => /usr/lib/systemd/user
diff -Naur openssh-6.7p1.orig/debian/README.Debian openssh-6.7p1/debian/README.Debian
--- openssh-6.7p1.orig/debian/README.Debian	2015-03-23 00:08:49.000000000 +0100
+++ openssh-6.7p1/debian/README.Debian	2015-06-11 11:31:27.618079976 +0200
@@ -229,6 +229,19 @@
 copying /lib/systemd/system/ssh.socket to /etc/systemd/system/ssh.socket and
 modifying the ListenStream option.  See systemd.socket(5) for details.
 
+Starting ssh-agent with systemd
+-------------------------------
+
+ssh-agent can be launched through a systemd user unit. The unit is shipped
+as /usr/lib/systemd/user/ssh-agent.service.
+
+It needs to be enabled on a per-user basis by running
+
+systemctl --user enabled ssh-agent
+
+It creates a socket ssh-agent.socket inside the $XDG_RUNTIME_DIR directory,
+so make sure your environment variable $SSH_AUTH_SOCK points to that.
+
 -- 
 Matthew Vernon <matthew@debian.org>
 Colin Watson <cjwatson@debian.org>
diff -Naur openssh-6.7p1.orig/debian/ssh-agent.service openssh-6.7p1/debian/ssh-agent.service
--- openssh-6.7p1.orig/debian/ssh-agent.service	1970-01-01 01:00:00.000000000 +0100
+++ openssh-6.7p1/debian/ssh-agent.service	2015-06-11 11:31:47.670372124 +0200
@@ -0,0 +1,11 @@
+[Unit]
+Description=SSH authentication agent
+Before=default.target
+
+[Service]
+Type=forking
+Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket
+ExecStart=/usr/bin/ssh-agent -a $SSH_AUTH_SOCK
+
+[Install]
+WantedBy=default.target


Reply to: