ssh: tweak default controlPath
Instead of using the hostname `%h`, which can be changed by the
~/.ssh/config file, use the commandline-given hostname `%n`.
This allows to alias a host with different hostnames, which then point
to different configurations. A common use-case for this is if you have
multiple accounts on github with each access to different private repos:
Host github.com
IdentitiesOnly yes
User git
IdentityFile ~/.ssh/id_rsa
Host customer.github.com
IdentitiesOnly yes
User git
IdentityFile ~/.ssh/customer
HostName github.com
Without this change, if a connection was established with the first
github.com alias, then the user would try to pull a repo from the second
account, ssh would re-use the SSH connection which doesn't have access
to that repository.
(cherry picked from commit 40b279e3a3
)
This commit is contained in:
parent
7ab6441ab7
commit
b535770bd4
|
@ -219,7 +219,7 @@ in
|
||||||
|
|
||||||
controlPath = mkOption {
|
controlPath = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "~/.ssh/master-%r@%h:%p";
|
default = "~/.ssh/master-%r@%n:%p";
|
||||||
description = ''
|
description = ''
|
||||||
Specify path to the control socket used for connection sharing.
|
Specify path to the control socket used for connection sharing.
|
||||||
'';
|
'';
|
||||||
|
|
Loading…
Reference in a new issue