Trac is being migrated to new services! Issues can be found in our new
YouTrack instance and WIKI pages can be found on our
website.
- Timestamp:
-
Aug 10, 2008, 8:15:55 PM (15 years ago)
- Author:
-
trac
- Comment:
-
--
Legend:
- Unmodified
- Added
- Removed
- Modified
-
v1
|
v2
|
|
21 | 21 | $ tracd -p 8080 /path/to/project |
22 | 22 | }}} |
| 23 | Stricly speaking this will make your Trac accessible to everybody from your network rather than ''localhost only''. To truly limit it use ''--hostname'' option. |
| 24 | {{{ |
| 25 | $ tracd --hostname=localhost -p 8080 /path/to/project |
| 26 | }}} |
23 | 27 | With more than one project. (http://localhost:8080/project1/ and http://localhost:8080/project2/) |
24 | 28 | {{{ |
… |
… |
|
34 | 38 | }}} |
35 | 39 | |
| 40 | To exit the server on Windows, be sure to use {{{CTRL-BREAK}}} -- using {{{CTRL-C}}} will leave a Python process running in the background. |
| 41 | |
| 42 | |
36 | 43 | == Using Authentication == |
37 | 44 | |
38 | | Tracd provides support for both Basic and Digest authentication. The default is to use Digest; to use Basic authentication, replace `--auth` with `--basic-auth` in the examples below, and omit the realm. |
| 45 | Using tracd with Apache .htpasswd files: |
| 46 | |
| 47 | To create a .htpasswd file using htpasswd: |
| 48 | |
| 49 | {{{ |
| 50 | sudo htpasswd -c /path/to/env/.htpasswd username |
| 51 | }}} |
| 52 | then for additional users: |
| 53 | {{{ |
| 54 | sudo htpasswd /var/www/html/.htpasswd-users username2 |
| 55 | }}} |
| 56 | then for starting the tracd: |
| 57 | {{{ |
| 58 | tracd -p 8080 --basic-auth=environmentname,/fullpath/environmentname/.htpasswd,/fullpath/environmentname /fullpath/environmentname |
| 59 | }}} |
| 60 | |
| 61 | |
| 62 | Tracd provides support for both Basic and Digest authentication. The default is to use Digest; to use Basic authentication, replace `--auth` with `--basic-auth` in the examples below. (You must still specify a dialogic "realm", which can be an empty string by trailing the BASICAUTH with a comma.) |
39 | 63 | |
40 | 64 | ''Support for Basic authentication was added in version 0.9.'' |
41 | 65 | |
42 | | If the file `/path/to/users.htdigest` contains user accounts for project1 with the realm "mycompany.com", you'd use the following command-line to start tracd: |
| 66 | The general format for using authentication is: |
| 67 | |
43 | 68 | {{{ |
44 | | $ tracd -p 8080 --auth project1,/path/to/users.htdigest,mycompany.com /path/to/project1 |
| 69 | $ tracd -p port --auth=base_project_dir,password_file_path,realm project_path |
45 | 70 | }}} |
46 | 71 | |
47 | | '''Note''': the project "name" passed to the `--auth` option is the base name of the project environment directory. |
| 72 | where: |
48 | 73 | |
| 74 | * '''base_project_dir''' is the base directory of the project; note: this doesn't refer to the project name, and it is case-sensitive even for windows environments |
| 75 | * '''password_file_path''' path of the password file |
| 76 | * '''realm''' realm |
| 77 | * '''project_path''' path of the project |
| 78 | |
| 79 | Example: |
| 80 | |
| 81 | {{{ |
| 82 | $ tracd -p 8080 \ |
| 83 | --auth=project1,/path/to/users.htdigest,mycompany.com /path/to/project1 |
| 84 | }}} |
49 | 85 | Of course, the digest file can be be shared so that it is used for more than one project: |
50 | 86 | {{{ |
51 | 87 | $ tracd -p 8080 \ |
52 | | --auth project1,/path/to/users.htdigest,mycompany.com \ |
53 | | --auth project2,/path/to/users.htdigest,mycompany.com \ |
| 88 | --auth=project1,/path/to/users.htdigest,mycompany.com \ |
| 89 | --auth=project2,/path/to/users.htdigest,mycompany.com \ |
54 | 90 | /path/to/project1 /path/to/project2 |
55 | 91 | }}} |
… |
… |
|
59 | 95 | {{{ |
60 | 96 | $ tracd -p 8080 \ |
61 | | --auth *,/path/to/users.htdigest,mycompany.com \ |
| 97 | --auth=*,/path/to/users.htdigest,mycompany.com \ |
62 | 98 | /path/to/project1 /path/to/project2 |
63 | 99 | }}} |
… |
… |
|
74 | 110 | |
75 | 111 | {{{ |
| 112 | #!python |
76 | 113 | from optparse import OptionParser |
77 | 114 | import md5 |
… |
… |
|
100 | 137 | {{{ |
101 | 138 | python trac-digest.py -u username -p password >> c:\digest.txt |
102 | | python tracd --port 8000 --auth proj_name,c:\digest.txt,trac c:\path\to\proj_name |
| 139 | tracd --port 8000 --auth=proj_name,c:\digest.txt,trac c:\path\to\proj_name |
103 | 140 | }}} |
| 141 | |
| 142 | Note: If you would like to use --basic-auth you need to use htpasswd tool from apache server to generate .htpasswd file. The remaining part is similar but make sure to use empty realm (i.e. coma after path). When using on Windows make sure to use -m option for it (did not tested it on *nix, so not sure if that is the case there). If you do not have Apache, [trac:source:/tags/trac-0.11b2/contrib/htpasswd.py htpasswd.py] may help. (Note that it requires a `crypt` or `fcrypt` module; see the source comments for details.) |
| 143 | |
| 144 | It is possible to use md5sum utility to generate digest-password file using such method: |
| 145 | {{{ |
| 146 | echo -e "${user}:trac:${password}\c" | md5sum - >>to-file |
| 147 | }}} |
| 148 | and manually delete " -" from the end and add "${user}:trac:" to the start of line from 'to-file'. You can see attachment:trac-digest-corrected.sh for detail. |
104 | 149 | |
105 | 150 | == Tips == |
… |
… |
|
123 | 168 | `htdocs:software-0.1.tar.gz`. |
124 | 169 | |
| 170 | === Using apache rewrite rules === |
| 171 | In some situations when you choose to use tracd behind apache, you might experience issues with redirects, like being redirected to URLs with the wrong host or protocol. In this case (and only in this case), setting the `[trac] use_base_url_for_redirect` to `true` can help, as this will force Trac to use the value of `[trac] base_url` for doing the redirects. |
| 172 | |
| 173 | === Serving a different base path than / === |
| 174 | Tracd supports serving projects with different base urls then /<project>. The parameter name to change this is |
| 175 | {{{ |
| 176 | tracd --base-path=/some/path |
| 177 | }}} |
| 178 | |
125 | 179 | ---- |
126 | 180 | See also: TracInstall, TracCgi, TracModPython, TracGuide |
127 | | |
128 | | ---- |
129 | | '''Translation:''' |
130 | | * [https://opensvn.csie.org/traccgi/trac_rus/wiki/StandAloneTracForTeapot Russian] (перевод на Русский) |
All information, including names and email addresses, entered onto this website or sent to mailing lists affiliated with this website will be public. Do not post confidential information, especially passwords!