mirror of
https://github.com/frebib/dotfiles.git
synced 2024-06-14 12:57:23 +00:00
ssh: Add systemd ssh@ unit for persistent master connections
These rely on SSH configuring ControlMaster and ControlSocket for the host so the connection can be reused. Signed-off-by: Joe Groocock <me@frebib.net>
This commit is contained in:
parent
8e74101f3e
commit
b519b48e83
13
ssh/askpass
Executable file
13
ssh/askpass
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
if [ -z "$SSH_HOST" ]; then
|
||||
>&2 echo 'Missing SSH_HOST variable'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$SSH_HOST" in
|
||||
*)
|
||||
echo 'Unknown SSH host'
|
||||
exit 1
|
||||
;;
|
||||
esac
|
13
systemd/user/ssh@.service
Normal file
13
systemd/user/ssh@.service
Normal file
@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=SSH persistent connection to %i
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
Slice=ssh.slice
|
||||
Environment=SSH_ASKPASS=%E/ssh/askpass
|
||||
Environment=SSH_HOST=%i
|
||||
ExecStart=/usr/bin/ssh -fNT %i
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=ssh.target
|
Loading…
Reference in New Issue
Block a user