Skip to content

Instantly share code, notes, and snippets.

@polyrand
Forked from olbat/ssh-tunnel-systemd.md
Last active November 26, 2020 18:07
Show Gist options
  • Select an option

  • Save polyrand/6f9987a7cfb09244a8e18f61b814c2d7 to your computer and use it in GitHub Desktop.

Select an option

Save polyrand/6f9987a7cfb09244a8e18f61b814c2d7 to your computer and use it in GitHub Desktop.
systemd SSH tunnel

~/.config/systemd/user/ssh-agent.service

systemctl --user enable ssh-agent
systemctl --user start ssh-agent
echo 'export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"' >> ~/.bashrc
source ~/.bashrc
ssh-add

~/.config/systemd/user/ssh-tunnel@.service

~/.ssh/tunnels/localhost-test

systemctl --user start ssh-tunnel@localhost-test
systemctl --user enable ssh-tunnel@localhost-test
systemctl --user status -l ssh-tunnel@localhost-test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment