<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to TracCgi</title><link>https://sourceforge.net/p/deepmethod/wiki/TracCgi/</link><description>Recent changes to TracCgi</description><atom:link href="https://sourceforge.net/p/deepmethod/wiki/TracCgi/feed" rel="self"/><language>en</language><lastBuildDate>Wed, 11 Feb 2015 12:39:36 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/deepmethod/wiki/TracCgi/feed" rel="self" type="application/rss+xml"/><item><title>TracCgi modified by KKozlov</title><link>https://sourceforge.net/p/deepmethod/wiki/TracCgi/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;a class="" href="../TracCgi?action=diff&amp;amp;version=1"&gt;Last modified&lt;/a&gt; &lt;a class="" href="/trac/DEEP/timeline?from=2012-08-22T09%3A39%3A22%2B04%3A00&amp;amp;precision=second"&gt;2 years&lt;/a&gt; ago&lt;/p&gt;
&lt;h1 id="installing-trac-as-cgi"&gt;Installing Trac as CGI&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Please note that using Trac via CGI is the slowest deployment method available. It is slower than &lt;a class="" href="../TracModPython"&gt;mod_python&lt;/a&gt;, &lt;a class="" href="../TracFastCgi"&gt;FastCGI&lt;/a&gt; and even &lt;a class="" href="http://trac.edgewall.org/intertrac/TracOnWindowsIisAjp" rel="nofollow"&gt; IIS/AJP&lt;/a&gt; on Windows.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;CGI script is the entrypoint that web-server calls when a web-request to an application is made. To generate the &lt;code&gt;trac.cgi&lt;/code&gt; script run: &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;trac&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;admin&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt; &lt;span class="n"&gt;deploy&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;www&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;trac&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;code&gt;trac.cgi&lt;/code&gt; will be in the &lt;code&gt;cgi-bin&lt;/code&gt; folder inside the given path. Make sure it is executable by your web server. This command also copies &lt;code&gt;static resource&lt;/code&gt; files to a &lt;code&gt;htdocs&lt;/code&gt; directory of a given destination. &lt;/p&gt;
&lt;h2 id="apache-web-server-configuration"&gt;Apache web-server configuration&lt;/h2&gt;
&lt;p&gt;In &lt;a class="" href="http://httpd.apache.org" rel="nofollow"&gt; Apache&lt;/a&gt; there are two ways to run Trac as CGI: &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Use a &lt;code&gt;ScriptAlias&lt;/code&gt; directive that maps an URL to the &lt;code&gt;trac.cgi&lt;/code&gt; script (recommended) &lt;/li&gt;
&lt;li&gt;Copy the &lt;code&gt;trac.cgi&lt;/code&gt; file into the directory for CGI executables used by your web server (commonly named &lt;code&gt;cgi-bin&lt;/code&gt;). You can also create a symbolic link, but in that case make sure that the &lt;code&gt;FollowSymLinks&lt;/code&gt; option is enabled for the &lt;code&gt;cgi-bin&lt;/code&gt; directory. &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;To make Trac available at &lt;code&gt;http://yourhost.example.org/trac&lt;/code&gt; add &lt;code&gt;ScriptAlias&lt;/code&gt; directive to Apache configuration file, changing &lt;code&gt;trac.cgi&lt;/code&gt; path to match your installation: &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;ScriptAlias&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;trac&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;www&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;trac&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;cgi&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;bin&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;trac&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cgi&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Note that this directive requires enabled &lt;code&gt;mod_alias&lt;/code&gt; module.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;If you're using Trac with a single project you need to set its location using the &lt;code&gt;TRAC_ENV&lt;/code&gt; environment variable: &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="nt"&gt;&amp;lt;Location&lt;/span&gt; &lt;span class="err"&gt;"/trac"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  SetEnv TRAC_ENV "/path/to/projectenv"
&lt;span class="nt"&gt;&amp;lt;/Location&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Or to use multiple projects you can specify their common parent directory using the &lt;code&gt;TRAC_ENV_PARENT_DIR&lt;/code&gt; variable: &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="nt"&gt;&amp;lt;Location&lt;/span&gt; &lt;span class="err"&gt;"/trac"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  SetEnv TRAC_ENV_PARENT_DIR "/path/to/project/parent/dir"
&lt;span class="nt"&gt;&amp;lt;/Location&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Note that the &lt;code&gt;SetEnv&lt;/code&gt; directive requires enabled &lt;code&gt;mod_env&lt;/code&gt; module. It is also possible to set TRAC_ENV in trac.cgi. Just add the following code between "try:" and "from trac.web ...":&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;    &lt;span class="n"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
    &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="n"&gt;TRAC_ENV&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"/path/to/projectenv"&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;_ Or for TRAC_ENV_PARENT_DIR: _&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;    &lt;span class="n"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
    &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="n"&gt;TRAC_ENV_PARENT_DIR&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"/path/to/project/parent/dir"&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If you are using the &lt;a class="" href="http://httpd.apache.org/docs/suexec.html" rel="nofollow"&gt; Apache suEXEC&lt;/a&gt; feature please see &lt;a class="" href="http://trac.edgewall.org/wiki/ApacheSuexec" rel="nofollow"&gt; &lt;/a&gt;&lt;a href="http://trac.edgewall.org/wiki/ApacheSuexec" rel="nofollow"&gt;&lt;/a&gt;&lt;a href="http://trac.edgewall.org/wiki/ApacheSuexec" rel="nofollow"&gt;http://trac.edgewall.org/wiki/ApacheSuexec&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;On some systems, you &lt;em&gt;may&lt;/em&gt; need to edit the shebang line in the &lt;code&gt;trac.cgi&lt;/code&gt; file to point to your real Python installation path. On a Windows system you may need to configure Windows to know how to execute a .cgi file (Explorer -&amp;gt; Tools -&amp;gt; Folder Options -&amp;gt; File Types -&amp;gt; CGI). &lt;/p&gt;
&lt;h2 id="mapping-static-resources"&gt;Mapping Static Resources&lt;/h2&gt;
&lt;p&gt;Out of the box, Trac will pass static resources such as style sheets or images through itself. For a CGI setup this is &lt;strong&gt;highly undesirable&lt;/strong&gt;, because this way CGI script is invoked for documents that could be much more efficiently served directly by web server. &lt;/p&gt;
&lt;p&gt;Web servers such as &lt;a class="" href="http://httpd.apache.org" rel="nofollow"&gt; Apache&lt;/a&gt; allow you to create “Aliases” to resources, giving them a virtual URL that doesn't necessarily reflect the layout of the servers file system. We already used this capability by defining a &lt;code&gt;ScriptAlias&lt;/code&gt; for the CGI script. We also can map requests for static resources directly to the directory on the file system, avoiding processing these requests by CGI script. &lt;/p&gt;
&lt;p&gt;There are two primary URL paths for static resources - &lt;code&gt;/chrome/common&lt;/code&gt; and &lt;code&gt;/chrome/site&lt;/code&gt;. Plugins can add their own resources usually accessible by &lt;code&gt;/chrome/plugin&lt;/code&gt; path, so its important to override only known paths and not try to make universal &lt;code&gt;/chrome&lt;/code&gt; alias for everything. &lt;/p&gt;
&lt;p&gt;Add the following snippet to Apache configuration &lt;strong&gt;before&lt;/strong&gt; the &lt;code&gt;ScriptAlias&lt;/code&gt; for the CGI script, changing paths to match your deployment: &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="nx"&gt;Alias&lt;/span&gt; &lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;trac&lt;/span&gt;&lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;chrome&lt;/span&gt;&lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;common&lt;/span&gt; &lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="nb"&gt;path&lt;/span&gt;&lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="k"&gt;to&lt;/span&gt;&lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;trac&lt;/span&gt;&lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;htdocs&lt;/span&gt;&lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;common&lt;/span&gt;
&lt;span class="nx"&gt;Alias&lt;/span&gt; &lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;trac&lt;/span&gt;&lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;chrome&lt;/span&gt;&lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;site&lt;/span&gt; &lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="nb"&gt;path&lt;/span&gt;&lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="k"&gt;to&lt;/span&gt;&lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;trac&lt;/span&gt;&lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;htdocs&lt;/span&gt;&lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;site&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Directory&lt;/span&gt; &lt;span class="s2"&gt;"/path/to/www/trac/htdocs"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="k"&gt;Order&lt;/span&gt; &lt;span class="nx"&gt;allow&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;deny&lt;/span&gt;
  &lt;span class="nx"&gt;Allow&lt;/span&gt; &lt;span class="nb"&gt;from&lt;/span&gt; &lt;span class="kc"&gt;all&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nx"&gt;Directory&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If using mod_python, you might want to add this too (otherwise, the alias will be ignored): &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="nt"&gt;&amp;lt;Location&lt;/span&gt; &lt;span class="err"&gt;"/trac/chrome/common/"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  SetHandler None
&lt;span class="nt"&gt;&amp;lt;/Location&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Note that we mapped &lt;code&gt;/trac&lt;/code&gt; part of the URL to the &lt;code&gt;trac.cgi&lt;/code&gt; script, and the path &lt;code&gt;/chrome/common&lt;/code&gt; is the path you have to append to that location to intercept requests to the static resources. &lt;/p&gt;
&lt;p&gt;For example, if Trac is mapped to &lt;code&gt;/cgi-bin/trac.cgi&lt;/code&gt; on your server, the URL of the Alias should be &lt;code&gt;/cgi-bin/trac.cgi/chrome/common&lt;/code&gt;. &lt;/p&gt;
&lt;p&gt;Similarly, if you have static resources in a project's htdocs directory (which is referenced by /chrome/site URL in themes), you can configure Apache to serve those resources (again, put this &lt;strong&gt;before&lt;/strong&gt; the &lt;code&gt;ScriptAlias&lt;/code&gt; for the CGI script, and adjust names and locations to match your installation): &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="nx"&gt;Alias&lt;/span&gt; &lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;trac&lt;/span&gt;&lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;chrome&lt;/span&gt;&lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;site&lt;/span&gt; &lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="nb"&gt;path&lt;/span&gt;&lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="k"&gt;to&lt;/span&gt;&lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;projectenv&lt;/span&gt;&lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;htdocs&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Directory&lt;/span&gt; &lt;span class="s2"&gt;"/path/to/projectenv/htdocs"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="k"&gt;Order&lt;/span&gt; &lt;span class="nx"&gt;allow&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;deny&lt;/span&gt;
  &lt;span class="nx"&gt;Allow&lt;/span&gt; &lt;span class="nb"&gt;from&lt;/span&gt; &lt;span class="kc"&gt;all&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nx"&gt;Directory&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Alternatively to hacking &lt;code&gt;/trac/chrome/site&lt;/code&gt;, you can directly specify path to static resources using &lt;code&gt;htdocs_location&lt;/code&gt; configuration option in &lt;a class="" href="../TracIni"&gt;trac.ini&lt;/a&gt;: &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="k"&gt;[trac]&lt;/span&gt;
&lt;span class="na"&gt;htdocs_location&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;http://yourhost.example.org/trac-htdocs&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Trac will then use this URL when embedding static resources into HTML pages. Of course, you still need to make the Trac &lt;code&gt;htdocs&lt;/code&gt; directory available through the web server at the specified URL, for example by copying (or linking) the directory into the document root of the web server: &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="err"&gt;$&lt;/span&gt; &lt;span class="n"&gt;ln&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;www&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;trac&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;htdocs&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;www&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;yourhost&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;example&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;org&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;trac&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;htdocs&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Note that in order to get this &lt;code&gt;htdocs&lt;/code&gt; directory, you need first to extract the relevant Trac resources using the &lt;code&gt;deploy&lt;/code&gt; command of &lt;span&gt;[TracAdmin]&lt;/span&gt;: &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="nx"&gt;deploy&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;directory&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;

    &lt;span class="nb"&gt;Extract&lt;/span&gt; &lt;span class="nx"&gt;static&lt;/span&gt; &lt;span class="nb"&gt;resources&lt;/span&gt; &lt;span class="nb"&gt;from&lt;/span&gt; &lt;span class="nx"&gt;Trac&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="kc"&gt;all&lt;/span&gt; &lt;span class="nx"&gt;plugins&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="adding-authentication"&gt;Adding Authentication&lt;/h2&gt;
&lt;p&gt;The simplest way to enable authentication with Apache is to create a password file. Use the &lt;code&gt;htpasswd&lt;/code&gt; program to create the password file: &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="err"&gt;$&lt;/span&gt; &lt;span class="n"&gt;htpasswd&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;somewhere&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;trac&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;htpasswd&lt;/span&gt; &lt;span class="n"&gt;admin&lt;/span&gt;
&lt;span class="n"&gt;New&lt;/span&gt; &lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;type&lt;/span&gt; &lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="n"&gt;Re&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;type&lt;/span&gt; &lt;span class="n"&gt;new&lt;/span&gt; &lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;type&lt;/span&gt; &lt;span class="n"&gt;password&lt;/span&gt; &lt;span class="n"&gt;again&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="n"&gt;Adding&lt;/span&gt; &lt;span class="n"&gt;password&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="n"&gt;admin&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After the first user, you dont need the "-c" option anymore: &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="err"&gt;$&lt;/span&gt; &lt;span class="n"&gt;htpasswd&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;somewhere&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;trac&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;htpasswd&lt;/span&gt; &lt;span class="n"&gt;john&lt;/span&gt;
&lt;span class="n"&gt;New&lt;/span&gt; &lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;type&lt;/span&gt; &lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="n"&gt;Re&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;type&lt;/span&gt; &lt;span class="n"&gt;new&lt;/span&gt; &lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;type&lt;/span&gt; &lt;span class="n"&gt;password&lt;/span&gt; &lt;span class="n"&gt;again&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="n"&gt;Adding&lt;/span&gt; &lt;span class="n"&gt;password&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="n"&gt;john&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;See the man page for &lt;code&gt;htpasswd&lt;/code&gt; for full documentation.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;After you've created the users, you can set their permissions using &lt;span&gt;[TracPermissions]&lt;/span&gt;. &lt;/p&gt;
&lt;p&gt;Now, you'll need to enable authentication against the password file in the Apache configuration: &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="nt"&gt;&amp;lt;Location&lt;/span&gt; &lt;span class="err"&gt;"/trac/login"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  AuthType Basic
  AuthName "Trac"
  AuthUserFile /somewhere/trac.htpasswd
  Require valid-user
&lt;span class="nt"&gt;&amp;lt;/Location&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If you're hosting multiple projects you can use the same password file for all of them: &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="nt"&gt;&amp;lt;LocationMatch&lt;/span&gt; &lt;span class="err"&gt;"/trac/&lt;/span&gt;&lt;span class="cp"&gt;[&lt;/span&gt;&lt;span class="p"&gt;^&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="cp"&gt;]&lt;/span&gt;&lt;span class="err"&gt;+/login"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  AuthType Basic
  AuthName "Trac"
  AuthUserFile /somewhere/trac.htpasswd
  Require valid-user
&lt;span class="nt"&gt;&amp;lt;/LocationMatch&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;For better security, it is recommended that you either enable SSL or at least use the “digest” authentication scheme instead of “Basic”. Please read the &lt;a class="" href="http://httpd.apache.org/docs/2.0" rel="nofollow"&gt; Apache HTTPD documentation&lt;/a&gt; to find out more. For example, on a Debian 4.0r1 (etch) system the relevant section in apache configuration can look like this: &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="nt"&gt;&amp;lt;Location&lt;/span&gt; &lt;span class="err"&gt;"/trac/login"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    LoadModule auth_digest_module /usr/lib/apache2/modules/mod_auth_digest.so
    AuthType Digest
    AuthName "trac"
    AuthDigestDomain /trac
    AuthUserFile /somewhere/trac.htpasswd
    Require valid-user
&lt;span class="nt"&gt;&amp;lt;/Location&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;and you'll have to create your .htpasswd file with htdigest instead of htpasswd as follows: &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="c"&gt;# htdigest /somewhere/trac.htpasswd trac admin&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;where the "trac" parameter above is the same as AuthName above ("Realm" in apache-docs). &lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;See also: &lt;span&gt;[TracGuide]&lt;/span&gt;, &lt;a class="alink" href="/p/deepmethod/wiki/TracInstall"&gt;[TracInstall]&lt;/a&gt;, &lt;a class="alink" href="/p/deepmethod/wiki/TracModWSGI"&gt;[TracModWSGI]&lt;/a&gt;, &lt;span&gt;[TracFastCgi]&lt;/span&gt;, &lt;span&gt;[TracModPython]&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">KKozlov</dc:creator><pubDate>Wed, 11 Feb 2015 12:39:36 -0000</pubDate><guid>https://sourceforge.nete25ed0411ebb55e390374d8b1c04d91a47bf9847</guid></item></channel></rss>