ssh-agent autostart

ssh-agent autostart


mkdir -p ~/.config/systemd/user/

echo '[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
'
> ~/.config/systemd/user/ssh-agent.service

### echo 'export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"' >> ~/.bashrc # or zshrc or similar

mkdir -p ~/.config/environment.d/

echo 'SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"' > ~/.config/environment.d/ssh-auth-sock.conf

systemctl --user enable --now ssh-agent

P.S.: in keepassxc or similar software with integration with ssh-agent may need setup socket path in settings

Содержание