Set up Subversion with SSH (svn+ssh)
Table of Contents [hide]
Setup SVN Server ∞
- Install Subversion
- Red Hat/CentOS/Fedora
- Debian Based (Ubuntu)
- Create a repository
- Create an SVN group (add whichever users you would like to it)
- Create svn user as part of the svn group.
- Give the new group ownership of the repos directory and set the permissions.
- Create a wrapper for svnserve at
/data01/svn/svnserve.sh
. - Symlink to
/usr/local/bin
. Set permissions appropriately.
sudo yum install subversion
sudo apt-get install subversion
sudo mkdir /data01/svn sudo mkdir /data01/svn/repos sudo svnadmin create /data01/svn/repos/new_repo
sudo groupadd svn sudo usermod -a -G svn svn_user
sudo useradd -g svn svn
sudo chown -R svn:svn /data01/svn sudo chmod -R 775 /data01/svn
#!/bin/sh # set the umask so that files are group writable umask 002 # call svnserve, passing the default repo location exec /usr/bin/svnserve "$@" -r /data01/svn/repos
cd /usr/local/bin/ sudo ln -s /data01/svn/svnserve.sh svnserve sudo chmod 755 /data01/svn/svnserve.sh
Setup Key-Based Authentication ∞
- Create public/private key pair using ssh-keygen on local machine.
- Copy the public key to remote host with ssh-copy-id
- Test login from remote-host. Verify that it is now passwordless
svn@cwch3wnsapvl001:/home/svn$ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/data01/home/svn/.ssh/id_rsa): Created directory '/data01/home/svn/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /data01/home/svn/.ssh/id_rsa. Your public key has been saved in /data01/home/svn/.ssh/id_rsa.pub. The key fingerprint is: 20:bc:01:62:a9:60:e6:0e:5a:3c:dc:12:d7:44:5e:f7 svn@ch3wnsapvl001.domain.com
ssh-copy-id -i ~/.ssh/id_rsa.pub user@remote-host
user@localhost:~$ ssh svn@wins.clearwire.com svn@cwch3wnsapvl001:~$0