Friday, October 28, 2022

[SOLVED] use non default ssh key with svn+ssh

Issue

I have a set up script that has parts that require root. Part of the setup is a svn+ssh checkout (which does not need root but is still run as root). I have a special user for ssh and I set up the keys such that if run as that user no password is needed and the automation works. However, since its run with sudo as a different user, svn+ssh looks in the wrong location for the key.

I know ssh has -i which allows me to specify the key file to use. Is there a way to sell svn+ssh to do that?


Solution

You can use arbitrary programs instead of ssh. Simply add the following to your config file (~/.subversion/config):

[tunnels]
ssh-otheruser = ssh -i /home/otheruser/.ssh/id_rsa

Then, you can checkout with

svn co svn+ssh-otheruser://...


Answered By - phihag
Answer Checked By - Candace Johnson (WPSolving Volunteer)