Changing the default identity with ssh-ident

This article was published 3 years ago. Due to the rapidly evolving world of technology, some concepts may no longer be applicable.

Whilst looking in to ssh-ident, I realised that by default it will look for an identity with the same name as the current user.

$ ssh
Warning: no keys found for identity michael in:
['/Users/michael/.ssh/identities/michael', '/Users/michael/.ssh']

Whilst this works, I sometimes use different names on different machines and wanted to use one identity across all machines.

To set the default, edit ~/.ssh-ident and add a MATCH_PATH block. This empty regex will match every check and enable personal as the default identity.

    (r"", "personal"),

If you want to specify multiple identities for different projects, you can. Just add them to MATCH_PATH before your default.

    (r"work-project-one", "work"),
    (r"work-project-two", "work"),
    (r"", "personal"),

Thoughts on this post

Leave a comment?

Leave a Reply