From 6f2d780da10934329bad6ac74a9e465b8e3aa757 Mon Sep 17 00:00:00 2001 From: "flyingscorpio@arch-desktop" Date: Thu, 30 Sep 2021 22:22:51 +0200 Subject: [PATCH] Add service file for ssh-agent --- configs.yml | 8 ++++++++ dotfiles/shell/profile | 1 + dotfiles/systemd/ssh-agent.service | 12 ++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 dotfiles/systemd/ssh-agent.service diff --git a/configs.yml b/configs.yml index 301cc7e..f477320 100644 --- a/configs.yml +++ b/configs.yml @@ -53,6 +53,14 @@ sudoers: - run: - sudo chmod 600 /etc/sudoers.d/setup-cockpit +ssh-agent: + - symlink: + - dotfiles/systemd/ssh-agent.service + - ~/.config/systemd/user/ssh-agent.service + - run: + - systemctl --user is-enabled ssh-agent >/dev/null || systemctl --user enable ssh-agent; + systemctl --user start ssh-agent + pacman.conf: - run: command: sudo cp /etc/pacman.conf /etc/pacman.conf.backup diff --git a/dotfiles/shell/profile b/dotfiles/shell/profile index 5327926..b272cb7 100644 --- a/dotfiles/shell/profile +++ b/dotfiles/shell/profile @@ -3,6 +3,7 @@ [[ -x /usr/bin/vim ]] && export EDITOR="/usr/bin/vim" export TERMINAL="kitty" +export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket" if systemctl -q is-active graphical.target && [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then exec startx diff --git a/dotfiles/systemd/ssh-agent.service b/dotfiles/systemd/ssh-agent.service new file mode 100644 index 0000000..5c59cbf --- /dev/null +++ b/dotfiles/systemd/ssh-agent.service @@ -0,0 +1,12 @@ +[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