ccontavalli / ssh-ident

Different agents and different keys for different projects, with ssh.
Other
965 stars 71 forks source link

An option for specifying global SSH options #30

Open s1kx opened 8 years ago

s1kx commented 8 years ago

In addition to SSH_DEFAULT_OPTIONS, there should also be an option SSH_GLOBAL_OPTIONS and/or a way to merge the identity config file with a global ssh config (e.g. ~/.ssh/config).

This is necessary to separate global options (such as UseRoaming/ServerAliveInterval/ServerAliveCountMax) from default options, which are semantically different and could be easy to confuse with one another. That's not to mention that repeating the same options for 10 identities is unidiomatic and prone to errors.

This issue especially affects users that use identity-specific configs, as otherwise you could simply place your global options in a Host * block in ~/.ssh/config.

One idiomatic way of solving this would be to create an ephemeral file to be used as the -F <config> argument. ssh-ident could append ~/.ssh/identities/%i/config and ~/.ssh/config to a new file (e.g. ~/.ssh/session-configs/%i) and pass that config file to ssh with -F. In order to make sure the file is up to date, it could use the timestamps of the identity config, the global config and compare it to the session-config to determine if it needs to be regenerated.

maddes-b commented 3 years ago

Have a look at my fork at https://github.com/maddes-b/ssh-ident There I extended SSH_OPTIONS to specify parameters per identiy and/or binary.