diff --git a/systemd/.config/systemd/user/ssh-agent.service b/systemd/.config/systemd/user/ssh-agent.service new file mode 100644 index 0000000..9428410 --- /dev/null +++ b/systemd/.config/systemd/user/ssh-agent.service @@ -0,0 +1,10 @@ +[Unit] +Description=SSH key agent + +[Service] +Type=simple +Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket +ExecStart=/usr/bin/ssh-agent -D -a $SSH_AUTH_SOCK + +[Install] +WantedBy=default.target diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 44d5ae2..117c711 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -8,6 +8,11 @@ if [[ -o interactive ]] && [[ -n $SSH_TTY ]] && [[ -z $TMUX ]] && type tmux &> / exit $? fi +# Check for service-managed keyring +if [[-z $SSH_AUTH_SOCK ]] && [[ -S $XDG_RUNTIME_DIR/ssh-agent.socket ]]; then + export SSH_AUTH_SOCKET="$XDG_RUNTIME_DIR/ssh-agent.socket" +fi + ####################### # Initialize keyboard # #######################