Deprecated: Returning a value from a constructor is deprecated in /var/www/michaelwiller.dk/public_html/blog/wp-includes/pomo/streams.php on line 317

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /var/www/michaelwiller.dk/public_html/blog/wp-includes/plugin.php on line 1014
ssh – Michael on IT

Tag: ssh

  • On using tls certificates and .ssh/config.

    On using tls certificates and .ssh/config.

    Just a quick note here on TLS certificates. Because I had to look it up and figure it out. Again!

    It is possible to define several keys for a site and login as different users using each certificate.

    I found myself needing to do just that for github.com, as my employer has private repositories there that I need to access.

    Adding something like this to $HOME/.ssh/config

    Host github-personal
        HostName github.com
        IdentityFile ~/.ssh/id_rsa_personal
    
    Host github-edb
        HostName github.com
        IdentityFile ~/.ssh/id_rsa_edb
    
    Host gitlab-personal
        HostName gitlab.com
        IdentityFile ~/.ssh/id_rsa_personal

    So instead of

    git clone git@github.com:EnterpriseDB/somerepo.git

    I’ll write:

    $ git clone git@github-edb:EnterpriseDB/somerepo.git

    or

    $ git clone git@github-personal:michaelwiller/somerepo.git

    … and the correct certificate will be applied to log me in.

    The same can be used for ssh shortcut names for servers and users. See this post as a reference.

    Photo by Markus Winkler on Unsplash