Subversion over SSH using specific identity

Everyone knows how to allow one particular system account to be shared among multiple SVN users and who doesn’t can have a look here. However, I had a somewhat inverted situation yesterday, and although the solution turned out to be trivial, finding it wasn’t to me. Supposedly my biggest problem was to put the issue into proper search terms.

Here is what I wanted. I have an system account two machines, one having the Subversion server running. The accounts trust each other through key-based authentication, but the main key that is trusted has a passphrase. Now adding the passphrase into a CRON job would be stupid, so I had to come up with something else, so I created a dedicated key-pair (without passphrase) just for SVN access and followed the steps described at the link above to restrict access with this key to one that uses svnserve -t.

Now the only problem was how to tell the the Subversion client to use that particular identity file when connecting. It turns out, that SVN_SSH (similar to CVS_RSH in CVS) does a good job in this. So while the “default” of this variable seems to be ssh, I simply specified the identity file and I was set.

export SVN_SSH="ssh -i /path/to/identity/file"

Hope this helps someone else to save some time when encountering a similar issue.

// Oliver

This entry was posted in IT Security, Programming, Software and tagged , , . Bookmark the permalink.

4 Responses to Subversion over SSH using specific identity

  1. paz says:

    ‘export SVN_SSH=”svn -i /path/to/identity/file”‘

    Umm… you sure that shouldn’t be

    ‘export SVN_SSH=”ssh -i /path/to/identity/file”‘?

    Thanks, though, I think this just might help me get around the problem of using svn with two different ssh identities.

  2. Oliver says:

    Corrected it above. Thanks for the hint 😉

  3. paz says:

    Np. Tried your trick, and sure enough it works.
    Turned out for our build scripts it’s easier to just ssh-add the other identity file at login, so that’s what we’re using now.

  4. Full Decent says:

    Thank you.

    For keyword stacking, I am hereby adding these tags to your article:

    svn+ssh, “ssh options”

Leave a Reply

Your email address will not be published. Required fields are marked *