Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

svn + ssh without password from command line?

Tags:

svn

I want to do

svn update /Users/radek/Sites/3.0.5/ -r HEAD --force

without the need of typing the password.

svn connects to our repository server but I am not sure under what username (how can I find out?). I guess it would be either root or radek

The password I type for svn to proceed is the same like root's one on repository server so I added my public key to root's authorized_keys file. So I ssh to repository server without typing password but it did not affect svn asking for password at all. The password of user radek on repository server is different to the one I type for svn up

If I commit something form Eclipse the author is radek.

Solution

svn info

told as which user I have to log in into repository server and then I added public key to its authorized_keys file. Now I do not have to enter pass when using svn.

like image 720
Radek Avatar asked Feb 25 '11 05:02

Radek


People also ask

Does SVN use SSH?

Assembla supports connecting to SVN repositories using SVN+SSH protocol, which provides security advantages. In this section we will discuss how you can set up your SVN client to use this protocol on Linux, Mac, and Windows computers.


2 Answers

There is a program called "ssh-agent" that will save an unlocked RSA or DSA key in memory and supply this key to SSH through a UNIX socket. This can be used for "password-less" SSH connections, assuming you generate an RSA or DSA public/private key pair, and add the public key to the "authorized_keys" or "authorized_keys2" file of the remote host. When you first add a key to ssh-agent or turn on ssh-agent, you will need to supply your password, but subsequent uses of SSH can occur without a password. You may find the following articles helpful in terms of setting up SSH agent:

  • Using ssh-agent with ssh
  • Shortest passwordless ssh tutorial, ever
  • How-To: "Password-less" SSH

Note that on Mac OS X (as of 10.5 and higher), if you generate the private/public key pair and put the public key in the authorized_keys file of the remote host, when you SSH into that host, Mac OS X will automatically start up its own ssh-agent (no setup required) and offer to remember the password (it will save it in KeyChain). You can read more about that on Mac OS X Leopard -- Built-In SSH Agent.

like image 179
Michael Aaron Safyan Avatar answered Sep 20 '22 17:09

Michael Aaron Safyan


If you can't use a key file, use sshpass (in Linux):

Install sshpass

$ sudo apt-get install sshpass

Set the temporary environment variable

$ export SSHPASS=yourpass

Edit the svn config file

$ nano ~/.subversion/config

Finally comment out add sshpass -e to ssh line, before the ssh command

ssh = $SVN_SSH sshpass -e ssh -q -o ControlMaster=no
like image 43
Francesco Avatar answered Sep 19 '22 17:09

Francesco