1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-27 13:39:46 +01:00

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.
This commit is contained in:
zimbatm 2018-11-28 15:24:19 +01:00 committed by Robert Helgesson
parent 5d8b089188
commit 40b279e3a3
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -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.
''; '';