From a34937643ddf1bbc1e7756a11505cddce1a60346 Mon Sep 17 00:00:00 2001 From: Andrew Coleman Date: Wed, 11 May 2022 08:14:30 -0400 Subject: [PATCH] add ssh-agent setup for linux --- README.md | 1 + dot_config/bash/ssh-agent.sh.tmpl | 4 ++++ dot_config/systemd/user/ssh-agent.service.tmpl | 14 ++++++++++++++ 3 files changed, 19 insertions(+) create mode 100644 dot_config/bash/ssh-agent.sh.tmpl create mode 100644 dot_config/systemd/user/ssh-agent.service.tmpl diff --git a/README.md b/README.md index e9b994f..29e2d8f 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,7 @@ pamac install \ # not available by default #jc mbuffer pamac build lightly-qt +systemctl enable --now --user ssh-agent.service ``` # Bitwarden diff --git a/dot_config/bash/ssh-agent.sh.tmpl b/dot_config/bash/ssh-agent.sh.tmpl new file mode 100644 index 0000000..e74b1e3 --- /dev/null +++ b/dot_config/bash/ssh-agent.sh.tmpl @@ -0,0 +1,4 @@ +{{- if (eq .chezmoi.os "linux") -}} +SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket" +export SSH_AUTH_SOCK +{{- end -}} diff --git a/dot_config/systemd/user/ssh-agent.service.tmpl b/dot_config/systemd/user/ssh-agent.service.tmpl new file mode 100644 index 0000000..1d2c0d9 --- /dev/null +++ b/dot_config/systemd/user/ssh-agent.service.tmpl @@ -0,0 +1,14 @@ +{{- if (eq .chezmoi.os "linux") -}} +[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 +{{- end -}}