From 1743dbc31922bf2e4b4c6b8a896c92e3dfcac887 Mon Sep 17 00:00:00 2001 From: RealStickman Date: Sun, 24 Apr 2022 15:06:17 +0200 Subject: [PATCH] (Grav GitSync) Automatic Commit from RealStickman --- pages/02.linux/04.ssh-agent/default.en.md | 33 +++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 pages/02.linux/04.ssh-agent/default.en.md diff --git a/pages/02.linux/04.ssh-agent/default.en.md b/pages/02.linux/04.ssh-agent/default.en.md new file mode 100644 index 0000000..4c0ba4f --- /dev/null +++ b/pages/02.linux/04.ssh-agent/default.en.md @@ -0,0 +1,33 @@ +--- +title: 'SSH Agent' +--- + +Autostarting an ssh-agent service + +## Systemd Service +A local service works for this. For example `~/.config/systemd/user/ssh-agent.service` +``` +[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 +``` + +Enable the systemd service +`systemctl --user enable --now ssh-agent` + +## Shell environment variable +The shell needs to know about the ssh-agent. In the case of fish, add this snippet to your config. +`set SSH_AUTH_SOCK /run/user/1000/ssh-agent.socket; export SSH_AUTH_SOCK` + +## SSH config +Modify the `~/.ssh/config` to add new keys automatically. +``` +AddKeysToAgent yes +```