B.nana Technology Log in
Version 9b6344a committed by Binokkio.

Systemd user service for ssh-agent

From https://wiki.archlinux.org/index.php/SSH_keys#Start_ssh-agent_with_systemd_user.

In .config/systemd/user/ssh-agent.service:

[Unit]
Description=SSH key agent

[Service]
Type=simple
Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket
# DISPLAY required for ssh-askpass to work
Environment=DISPLAY=:0
ExecStart=/usr/bin/ssh-agent -D -a $SSH_AUTH_SOCK

[Install]
WantedBy=default.target

In ~/.pam_environment:

SSH_AUTH_SOCK DEFAULT="${XDG_RUNTIME_DIR}/ssh-agent.socket"

And run:

systemctl enable --now --user ssh-agent