-
Notifications
You must be signed in to change notification settings - Fork 1
/
config
64 lines (54 loc) · 3.17 KB
/
config
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Note: Include directives must be before Host/Match directives, to prevent
# Include from being interpreted as inside a Host/Match, unless you want that.
# Per-host configuration for when the home directory is shared across multiple hosts.
Include ./config.d/per-host/config
# Note: Host-specific declarations should be before general ones, so that
# host-specific values are the first obtained.
# Host LocalName
# HostKeyAlias local-name
# HostName 1.2.3.4
# IdentityFile ~/.ssh/id_rsa
# Port 54321
# User me
# Hack that helps use multiplexed connections where desired, when the `-o` options cannot be
# supplied to the `ssh` commands but when environment variables can be supplied (e.g. for
# vagrant-tramp.el's `/vagrant:` method, as configured by my ~/.emacs.d/).
Match exec "env | grep -q -E -e '^MY_SSH_CONTROL_SOCKETS_DIR='"
ControlMaster auto
# Expect this directory to have already been created, by whatever application is using this
# environment variable. The pathname often involves the PID of a process (or some other unique,
# perhaps random, ID), to be limited in scope to that. About why %C is used, see the comment
# farther below.
ControlPath ${MY_SSH_CONTROL_SOCKETS_DIR}/%C
# Expect whatever application is using this environment variable to manage keeping the master
# connection alive as needed. Otherwise, persistent backgrounded `ssh` processes would be
# orphaned and accumulate, especially when ControlPath involves changing IDs. The duration
# specified here is short, only to help an application process when reestablishing a session
# within this duration (e.g. after a session errors/crashes, or after the user decides they want
# it back soon after having closed it).
ControlPersist 30m
# General default declarations
Host *
# User myself
# IdentityFile ~/.ssh/id_X
HashKnownHosts no
ServerAliveInterval 5
# ServerAliveCountMax 2 # Default is 3
# By default, don't create multiplexing, because this is more robust for my interactive sessions
# (because if the multiplexed connection has a problem, that interferes with (terminates or
# freezes) all sessions using it, which has happened to me both via accidents or via some bug in
# OpenSSH). But do use a multiplexed connection to a host if such was already created by
# something else (which is assumed to be intentional for the use here). Note that other apps
# (e.g. my Emacs configuration) can override this to create multiplexing, but those should use a
# different ControlPath namespace to be separate from my top namespace defined here and as such
# those will not cause my other sessions to use those.
ControlMaster no
# By locating these under $XDG_RUNTIME_DIR, they should be limited in scope to a particular local
# host, even when $HOME is in a file system shared across multiple hosts. (Note: the resulting
# length of this pathname must be less than `sizeof(sockaddr_un.sun_path) - some_extra` (see `man
# 7 unix`) which is only `108 - 17` on Linux. This is the primary reason to use the
# constant-length %C versus the other variable-length tokens, and is the reason to minimize the
# pathname length.)
ControlPath ${XDG_RUNTIME_DIR}/my/ssh/%C
# Average duration I'm awake per day.
ControlPersist 16h