Sophie

Sophie

distrib > Mageia > 5 > i586 > media > core-updates > by-pkgid > 27647990744ebd9cfe32398f37f67e20 > files > 2940

bzr-2.6.0-11.1.mga5.i586.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Simple Setups &mdash; Bazaar 2.6.0 documentation</title>
    
    <link rel="stylesheet" href="../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '2.6.0',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="shortcut icon" href="../_static/bzr.ico"/>
    <link rel="top" title="Bazaar 2.6.0 documentation" href="../index.html" />
    <link rel="up" title="Bazaar System Administrator’s Guide" href="index.html" />
    <link rel="next" title="Other Setups" href="other-setups.html" />
    <link rel="prev" title="Introduction" href="introduction.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="other-setups.html" title="Other Setups"
             accesskey="N">next</a></li>
        <li class="right" >
          <a href="introduction.html" title="Introduction"
             accesskey="P">previous</a> |</li>
<li><a href="http://bazaar.canonical.com/">
    <img src="../_static/bzr icon 16.png" /> Home</a>&nbsp;|&nbsp;</li>
<a href="http://doc.bazaar.canonical.com/en/">Documentation</a>&nbsp;|&nbsp;</li>

        <li><a href="../index.html">Table of Contents (2.6.0)</a> &raquo;</li>

          <li><a href="index.html" accesskey="U">Bazaar System Administrator&#8217;s Guide</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="simple-setups">
<h1>Simple Setups<a class="headerlink" href="#simple-setups" title="Permalink to this headline">¶</a></h1>
<p>Consider the following simple scenario where we will be serving Bazaar branches
that live on a single server.  Those branches are in the subdirectories of
<tt class="docutils literal"><span class="pre">/srv/bzr</span></tt> (or <tt class="docutils literal"><span class="pre">C:\bzr</span></tt>) and they will all be related to a single project
called &#8220;ProjectX&#8221;.  ProjectX will have a trunk branch and at least one feature
branch.  As we get further, we will consider other scenarios, but this will be
a sufficiently motivating example.</p>
<div class="section" id="smart-server">
<h2>Smart server<a class="headerlink" href="#smart-server" title="Permalink to this headline">¶</a></h2>
<p>The simplest possible setup for providing outside access to the branches on
the server uses Bazaar&#8217;s built-in smart server tunneled over <a class="reference external" href="http://www.openssh.org/">SSH</a> so
that people who can access your server using SSH can have read and write
access to branches on the server.  This setup uses the authentication
mechanisms of SSH including private keys, and the access control mechanisms of
the server&#8217;s operating system.  In particular, using groups on the server, it
is possible to provide different access privileges to different groups of
developers.</p>
<div class="section" id="setup">
<h3>Setup<a class="headerlink" href="#setup" title="Permalink to this headline">¶</a></h3>
<p>There is no setup required for this on the server, apart from having Bazaar
installed and SSH access available to your developers.  Using SSH
configuration options it is possible to restrict developers from using
anything <em>but</em> Bazaar on the server via SSH, and to limit what part of the
file system they can access.</p>
</div>
<div class="section" id="client">
<h3>Client<a class="headerlink" href="#client" title="Permalink to this headline">¶</a></h3>
<p>Clients can access the branches using URLs with the <tt class="docutils literal"><span class="pre">bzr+ssh://</span></tt> prefix.  For
example, to get a local copy of the ProjectX trunk, a developer could do:</p>
<div class="highlight-python"><div class="highlight"><pre>$ bzr branch bzr+ssh://server.example.com/srv/bzr/projectx/trunk projectx
</pre></div>
</div>
<p>If the developers have write access to the <tt class="docutils literal"><span class="pre">/srv/bzr/projectx</span></tt> directory, then
they can create new branches themselves using:</p>
<div class="highlight-python"><div class="highlight"><pre>$ bzr branch bzr+ssh://server.example.com/srv/bzr/projectx/trunk \
bzr+ssh://server.example.com/srv/bzr/projectx/feature-gui
</pre></div>
</div>
<p>Of course, if this isn&#8217;t desired, then developers should not have write access
to the <tt class="docutils literal"><span class="pre">/srv/bzr/projectx</span></tt> directory.</p>
</div>
<div class="section" id="further-configuration">
<h3>Further Configuration<a class="headerlink" href="#further-configuration" title="Permalink to this headline">¶</a></h3>
<p>For a project with multiple branches that are all related, it is best to use a
shared repository to hold all of the branches.  To set this up, do:</p>
<div class="highlight-python"><div class="highlight"><pre>$ cd /srv/bzr
$ bzr init-repo --no-trees projectx
</pre></div>
</div>
<p>The <tt class="docutils literal"><span class="pre">--no-trees</span></tt> option saves space by not creating a copy of the working
files on the server&#8217;s filesystem.  Then, any branch created under
<tt class="docutils literal"><span class="pre">/srv/bzr/projectx</span></tt> (see <a class="reference external" href="migration.html">Migration</a> for some ways to do
this) will share storage space, which is particularly helpful for branches that
have many revisions in common, such as a project trunk and its feature
branches.</p>
<p>If Bazaar is not installed on the user&#8217;s path or not specified in the SSH
configuration, then a path can be specified from the client with the
<tt class="docutils literal"><span class="pre">BZR_REMOTE_PATH</span></tt> environment variable.  For example, if the Bazaar executable
is installed in <tt class="docutils literal"><span class="pre">/usr/local/bzr-2.0/bin/bzr</span></tt>, then a developer could use:</p>
<div class="highlight-python"><div class="highlight"><pre>$ BZR_REMOTE_PATH=/usr/local/bzr-2.0/bin/bzr bzr info \
bzr+ssh://server.example.com/srv/bzr/proectx/trunk
</pre></div>
</div>
<p>to get information about the trunk branch.  The remote path can also be
specified in Bazaar&#8217;s configuration files for a particular location.  See
<tt class="docutils literal"><span class="pre">bzr</span> <span class="pre">help</span> <span class="pre">configuration</span></tt> for more details.</p>
<p>If developers have home directories on the server, they can use <tt class="docutils literal"><span class="pre">/~/</span></tt> in
URLs to refer to their home directory.  They can also use <tt class="docutils literal"><span class="pre">/~username/</span></tt> to
refer to the home directory of user <tt class="docutils literal"><span class="pre">username</span></tt>.  For example, if there are two
developers <tt class="docutils literal"><span class="pre">alice</span></tt> and <tt class="docutils literal"><span class="pre">bob</span></tt>, then Bob could use:</p>
<div class="highlight-python"><div class="highlight"><pre>$ bzr log bzr+ssh://server.example.com/~/fix-1023
</pre></div>
</div>
<p>to refer to one of his bug fix branches and:</p>
<div class="highlight-python"><div class="highlight"><pre>$ bzr log bzr+ssh://server.example.com/~alice/fix-2047
</pre></div>
</div>
<p>to refer to one of Alice&#8217;s branches. <a class="footnote-reference" href="#id2" id="id1">[1]</a></p>
<table class="docutils footnote" frame="void" id="id2" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[1]</a></td><td>The version of Bazaar installed on the server must be at least 2.1.0b1
or newer to support <tt class="docutils literal"><span class="pre">/~/</span></tt> in bzr+ssh URLs.</td></tr>
</tbody>
</table>
</div>
<div class="section" id="using-a-restricted-ssh-account-to-host-multiple-users-and-repositories">
<h3>Using a restricted SSH account to host multiple users and repositories<a class="headerlink" href="#using-a-restricted-ssh-account-to-host-multiple-users-and-repositories" title="Permalink to this headline">¶</a></h3>
<p>Once you have a bzr+ssh setup using a shared repository you may want to share
that repository among a small set of developers.  Using shared SSH access enables
you to complete this task without any complicated setup or ongoing management.</p>
<p>To allow multiple users to access Bazaar over ssh we can allow ssh access to a common
account that only allows users to run a specific command.  Using a single account
simplifies deployment as no permissions management issues exist for the filesystem.
All users are the same user at the server level.  Bazaar labels the commits with
each users details so seperate server accounts are not required.</p>
<p>To enable this configuration we update the <tt class="docutils literal"><span class="pre">~/.ssh/authorized_keys</span></tt> to include
command restrictions for connecting users.</p>
<p>In these examples the user will be called <tt class="docutils literal"><span class="pre">bzruser</span></tt>.</p>
<p>The following example shows how a single line is configured:</p>
<div class="highlight-python"><div class="highlight"><pre>command=&quot;bzr serve --inet --allow-writes --directory=/srv/bzr&quot;,no-agent-forwarding,no-port-forwarding,no-pty,no-user-rc,no-X11-forwarding ssh-rsa AAA...= my bzr key
</pre></div>
</div>
<p>This command allows the user to access only bzr and disables other SSH use.  Write
access to each repository in the directory <tt class="docutils literal"><span class="pre">/srv/bzr</span></tt> has been granted with <tt class="docutils literal"><span class="pre">--allow-writes</span></tt>
and can be removed for individual users that should only require read access.  The root of
the directory structure can be altered for each user to allow them to see only a subet
of the repositories available.  The example below assumes two seperate repositories
for Alice and Bob.  This method will not allow you to restrict access to part
of a repository, you may only restrict access to a single part of the directory structure:</p>
<div class="highlight-python"><div class="highlight"><pre>command=&quot;bzr serve --inet --allow-writes --directory=/srv/bzr/alice/&quot;,no-agent-forwarding,no-port-forwarding,no-pty,no-user-rc,no-X11-forwarding ssh-rsa AAA...= Alice&#39;s SSH Key
command=&quot;bzr serve --inet --allow-writes --directory=/srv/bzr/bob/&quot;,no-agent-forwarding,no-port-forwarding,no-pty,no-user-rc,no-X11-forwarding ssh-rsa AAA...= Bob&#39;s SSH Key
command=&quot;bzr serve --inet --allow-writes --directory=/srv/bzr/&quot;,no-agent-forwarding,no-port-forwarding,no-pty,no-user-rc,no-X11-forwarding ssh-rsa AAA...= Repo Manager SSH Key
</pre></div>
</div>
<p>Alice and Bob have access to their own repository and Repo Manager
has access to the each of their repositories.  Users are not allowed access to any part of
the system except the directory specified. The bzr+ssh urls are simplified by
serving using <tt class="docutils literal"><span class="pre">bzr</span> <span class="pre">serve</span></tt> and the <tt class="docutils literal"><span class="pre">--directory</span></tt> option.</p>
<p>If Alice logs in she uses the following command for her fix-1023 branch:</p>
<div class="highlight-python"><div class="highlight"><pre>$ bzr log bzr+ssh://bzruser@server.example.com/fix-1023
</pre></div>
</div>
<p>If Repo Manager logs in he uses the following command to access Alice&#8217;s
fix-1023:</p>
<div class="highlight-python"><div class="highlight"><pre>$ bzr log bzr+ssh://bzruser@server.example.com/alice/fix-1023
</pre></div>
</div>
</div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Simple Setups</a><ul>
<li><a class="reference internal" href="#smart-server">Smart server</a><ul>
<li><a class="reference internal" href="#setup">Setup</a></li>
<li><a class="reference internal" href="#client">Client</a></li>
<li><a class="reference internal" href="#further-configuration">Further Configuration</a></li>
<li><a class="reference internal" href="#using-a-restricted-ssh-account-to-host-multiple-users-and-repositories">Using a restricted SSH account to host multiple users and repositories</a></li>
</ul>
</li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="introduction.html"
                        title="previous chapter">Introduction</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="other-setups.html"
                        title="next chapter">Other Setups</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../_sources/admin-guide/simple-setups.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="other-setups.html" title="Other Setups"
             >next</a></li>
        <li class="right" >
          <a href="introduction.html" title="Introduction"
             >previous</a> |</li>
<li><a href="http://bazaar.canonical.com/">
    <img src="../_static/bzr icon 16.png" /> Home</a>&nbsp;|&nbsp;</li>
<a href="http://doc.bazaar.canonical.com/en/">Documentation</a>&nbsp;|&nbsp;</li>

        <li><a href="../index.html">Table of Contents (2.6.0)</a> &raquo;</li>

          <li><a href="index.html" >Bazaar System Administrator&#8217;s Guide</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2009-2011 Canonical Ltd.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
    </div>
  </body>
</html>