Skip to content

Generated ssh configuration ControlPath is too coarse #5062

@mrled

Description

@mrled

Description

The ssh config files in ~/.lima/MACHINE/ssh.config include:

Host lima-MACHINE
  ControlMaster auto
  ControlPath "/Users/USERNAME/.lima/MACHINE/ssh.sock"
  ControlPersist yes
  # ...

If you want to be able to connect to the machine as more than one user, this configuration breaks it in a confusing way.

user@host$ ssh firstuser@lima-MACHINE
firstuser@lima-MACHINE$ whoami
firstuser
firstuser@lima-MACHINE$ exit
user@host$ ssh seconduser@lima-MACHINE
firstuser@lima-MACHINE$ whoami
firstuser

As a workaround you can put a line like this in ~/.ssh/config before the lima include:

Host lima-MACHINE
  ControlPath ~/.lima/MACHINE/ssh.sock.%r

Include ~/.lima/*/ssh.config

But it would be nice if lima would configure this itself.

(You might prefer to use ~/.lima/MACHINE/ssh.sock.%C, which includes a hash of the username/hostname/port. The hostname doesn't help here, but the port might be useful if the user ever wanted to run a second ssh server on a different port.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/clilimactl CLI user experienceenhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions