Changing the default identity with ssh-ident

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.

MATCH_PATH = [
    (r"", "personal"),
]

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

MATCH_PATH = [
    (r"work-project-one", "work"),
    (r"work-project-two", "work"),
    (r"", "personal"),
]

Michael is a polyglot software engineer, committed to reducing complexity in systems and making them more predictable. Working with a variety of languages and tools, he shares his technical expertise to audiences all around the world at user groups and conferences. You can follow @mheap on Twitter

Thoughts on this post

Leave a comment?

Leave a Reply