install SSH Agent via service menu

This commit is contained in:
Stefan Gründel
2025-09-14 14:57:36 +02:00
parent 03ab27ed16
commit 12cdffa40f
2 changed files with 31 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
#!/bin/bash
# add ssh keys to ssh-agent
mkdir -p ~/.ssh
echo 'AddKeysToAgent yes' | tee -a ~/.ssh/config >/dev/null
# Create systemd service for ssh-agent
mkdir -p ~/.config/systemd/user
tee ~/.config/systemd/user/ssh-agent.service >/dev/null <<EOF
[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
EOF
# Ensure Hyprland picks up the SSH_AUTH_SOCK variable
echo 'env = SSH_AUTH_SOCK,$XDG_RUNTIME_DIR/ssh-agent.socket' | tee -a ~/.config/hypr/envs.conf >/dev/null
# Start ssh-agent automatically for user
systemctl enable --user ssh-agent.service
echo 'SSH Agent has been installed and enabled. Please reboot to apply changes.'

View File

@@ -221,6 +221,7 @@ show_install_service_menu() {
*Dropbox*) present_terminal omarchy-install-dropbox ;;
*Tailscale*) present_terminal omarchy-install-tailscale ;;
*Bitwarden*) install_and_launch "Bitwarden" "bitwarden bitwarden-cli" "bitwarden" ;;
*SSH Agent*) present_terminal omarchy-install-ssh-agent ;;
*) show_install_menu ;;
esac
}