Add Systemd service for ssh-agent; end SSH_AGENT environment variable.

This commit is contained in:
Philip Henning 2017-12-30 12:30:01 +01:00
parent 14f6e22294
commit aa36dbf190
3 changed files with 30 additions and 0 deletions

View file

@ -0,0 +1,20 @@
#
# {{@@ env['dotdrop_warning'] @@}}
#
[Unit]
Description=SSH key agent
Wants=environment.target
Before=environment.target
IgnoreOnIsolate=true
[Service]
Type=forking
Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket
ExecStart=/usr/bin/ssh-agent -a $SSH_AUTH_SOCK
ExecStartPost=/usr/bin/systemctl --user set-environment SSH_AUTH_SOCK=${SSH_AUTH_SOCK}
#ExecStop=/usr/bin/ssh-agent -k
ExecStopPost=/bin/rm ${SSH_AUTH_SOCK}
[Install]
WantedBy=default.target