<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>37 &#187; ssh</title>
	<atom:link href="http://blog.moopsfc.com/37/category/ssh/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.moopsfc.com/37</link>
	<description>the continuing saga of your hero</description>
	<lastBuildDate>Thu, 05 Mar 2009 03:20:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>setting up subversion on dapper</title>
		<link>http://blog.moopsfc.com/37/2007/06/20/setting-up-subversion-on-dapper/</link>
		<comments>http://blog.moopsfc.com/37/2007/06/20/setting-up-subversion-on-dapper/#comments</comments>
		<pubDate>Wed, 20 Jun 2007 20:48:25 +0000</pubDate>
		<dc:creator>brodie bruce</dc:creator>
				<category><![CDATA[backups]]></category>
		<category><![CDATA[computers]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[subversion]]></category>

		<guid isPermaLink="false">http://blog.moopsfc.com/37/2007/06/20/setting-up-subversion-on-dapper/</guid>
		<description><![CDATA[these are just some notes for myself on how i setup a subversion repository on ubuntu dapper using ssh for the access method. these should probably be combined into a script.
install software
you, obviously, have to have dapper installed and also subversion and an ssh server. on our network, you can just network boot and then [...]]]></description>
			<content:encoded><![CDATA[<p>these are just some notes for myself on how i setup a subversion repository on ubuntu dapper using ssh for the access method. these should probably be combined into a script.</p>
<h3>install software</h3>
<p>you, obviously, have to have dapper installed and also subversion and an ssh server. on our network, you can just network boot and then type &#8220;server&#8221; at the ubuntu prompt which should install the os. make sure that you either disable network booting or if in the dmz, configure an ip in the dhcp server for that specific mac address in order to not network boot anymore. after everything&#8217;s up:</p>
<blockquote><p>sudo apt-get install subversion openssh-server</p></blockquote>
<p>you now should be ready to go.</p>
<h3>setup the basic subversion area</h3>
<ol>
<li>create a subversion (svn) user:<br />
<blockquote><p>sudo adduser &#8211;disabled-password &#8211;home /var/lib/svn svn</p></blockquote>
</li>
<li>create a directory for the repositories and backups.<br />
<blockquote><p>sudo mkdir -m 2770 -p /var/lib/svn/repos /var/lib/svn/repos-backup</p></blockquote>
</li>
<li>make sure the owners are correct:<br />
<blockquote><p>sudo chown -R svn:svn /var/lib/svn</p></blockquote>
</li>
</ol>
<h3>setup a new repository</h3>
<ol>
<li>create a group for permissions for the new repository. i would make the group name the same as the name of the repository to reduce confusion.<br />
<blockquote><p>sudo addgroup [repo-group]</p></blockquote>
</li>
<li>create a directory where the repository will be located with the correct permissions. setting these permissions will  make sure that all of the directories and files that are created when the repository is created will have the proper group set.<br />
<blockquote><p>mkdir -m 2770 -p /var/lib/svn/repos/[repo-group]</p></blockquote>
</li>
<li>set the owner and group for the new repository:<br />
<blockquote><p>sudo chown svn:[repo-group] /var/lib/svn/repos/[repo-name]</p></blockquote>
</li>
<li>create the repository:<br />
<blockquote><p>svnadmin create &#8211;fs-type fsfs /var/lib/svn/repos/[repo-name]</p></blockquote>
</li>
<li>make sure the user and group is create on the files.</li>
<li>add users to the group who need access to this repository:<br />
<blockquote><p>sudo adduser [user] [repo-group]</p></blockquote>
</li>
</ol>
<p>i think that&#8217;s basically it. it seems best to create a separate repository for each project. that way it&#8217;s easy to keep permissions separated by project group. it&#8217;s also appears to not be a requirement with subversion to keep everything in one repository to be able to include them in other projects using modules as in cvs. i haven&#8217;t tested this functionality yet though. see <a href="http://svnbook.red-bean.com/en/1.2/svn.advanced.externals.html">external definitions</a> for more information.</p>
<h3>repository backups</h3>
<p>once you have your repositories setup, clearly you&#8217;re going to want to be backing up your precious data. at the current time, i&#8217;m taking the fairly simple approach of just backing up the entire repository every night using <em>svnadmin hotcopy</em>.</p>
<blockquote><p><a title="simple subversion backup script" id="p293" href="http://blog.moopsfc.com/37/backup-svn.txt">simple subversion backup script</a></p></blockquote>
<p>i just run this script for each repository every night using cron as the svn user. might should be looping through all repositories in the repos directory, but currently i&#8217;m just individually adding each to the crontab. the script doesn&#8217;t do any pruning of the backups. that&#8217;s the responsibility of the backup machine. what needs to be done is to setup a cronjob on the backup server under the target backup user that uses <em>find</em> to remove old backup files. each new backup has a timestamp in the name.<br />
the script just tars up the hotcopy directory and the pipes it to ssh and stores it on a machine we use for backups. to add a user to the backup machine:</p>
<blockquote><p>sudo adduser &#8211;disabled-password &#8211;home /home/backups/$USER $USER</p></blockquote>
<p>after creating the user, you should create a directory in the new user&#8217;s home directory that is the hostname from which you will be backing up. this way you could have backups from multiple machines going to the same user. alternatively, i guess you could create a user for each machine. then do backups as the root user on that machine (necessary for certain directories). this still needs to be worked out a bit.</p>
<p>then you have to generate an ssh key on the subversion machine to use for the backups and put the key on the backup machine under the user you just created. this command (all on one line) would be run as the svn user (or whatever user your doing backups for in the general case).</p>
<blockquote><p>ssh-keygen -b 4096 -t rsa -C $USER-backup@$HOSTNAME -f $HOME/.ssh/$USER-backup</p></blockquote>
<h3>adding new users</h3>
<p>this isn&#8217;t really specific to subversion, but is generally how servers should be configured. the only way to log into the server is using ssh with public keys. you can disabled root and password authentication in the /etc/ssh/sshd_config file. the best thing to do seems to be to add a default .ssh/authorized_keys file when the machine is first installed that includes the known ssh keys for admins. then, when a new user is added, these keys will be there by default. it&#8217;s then fairly easy for an admin to copy in the real user key and remove any admin keys if desired.</p>
<p>the passwords for all non-admin users are disabled. admins need there password in order to be able to run sudo. therefore, all admin users have to also be in the <em>admin</em> group (<code>sudo adduser [user] admin</code>). the same command for generating an ssh key as mentioned above can be used for generating keys.</p>
<p>this information should probably more flushed out in a different post. oh well. that should do for now.</p>
<h3>reference</h3>
<ul>
<li><a href="https://help.ubuntu.com/community/Subversion">subversion ubuntu community documentation</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.moopsfc.com/37/2007/06/20/setting-up-subversion-on-dapper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
