Search code examples
authenticationtrac

Cannot login into Trac via tracd


I need to use Trac for project management issues, but cannot setup authentication. I use the following link. There is no Apache server on my VPS needed, so I use default tracd server.

Following command is used for launching service:

tracd -s --port 8000 --basic-auth="myproj,/home/git/trac/myproj/
.htpasswd,myproj" /home/git/trac/myproj

In .htpasswd file follwing line is presented:

admin:f5a9455f6b064fd41d833d3f8f1376fb

where

f5a9455f6b064fd41d833d3f8f1376fb

is a password encrypted by MD5. This MD5 hash has been generated by online generator due to lack of htpasswd.py and htdigest.py in my installation (at least I did not manage to find it).

Actually, I was trying another encryptors (such as SHA-1 or SSHA) but with the same output.

When I try to login into trac via corresponding button in the top right corner, I get an error 401:

[29/May/2016 09:04:19] "GET /login HTTP/1.1" 401 -
[29/May/2016 09:04:27] "GET /login HTTP/1.1" 401 -
[29/May/2016 09:04:48] "GET /favicon.ico HTTP/1.1" 404 -
[29/May/2016 09:04:50] "GET / HTTP/1.1" 200 -
[29/May/2016 09:04:50] "GET / HTTP/1.1" 200 -

And the browser window for authentication appears again and again. What am I doing wrong?

Thank you for your answers!


Solution

  • Thanks for RjOllos who helped me to find the solution.

    The key of problem was hidden in password generation, as I expected. Probably it is possible to use the file htpasswd.py that was provided in the comment above. But I've done following:

    Check if htpasswd utility exists:

    which htpasswd
    

    if there is a following output

    root@server1:~# which htpasswd
    /usr/bin/htpasswd
    root@server1:~#
    

    you just can skip the next step.

    If not, you need to install apache-utils by command:

    apt-get install apache2-utils
    

    Then you can generate a password for a new user:

    htpasswd -c /home/git/trac/myproj/.htpasswd new_user
    

    After execution you will be prompted to type a password for 'new_user'.

    Finally, call the command provided above

    tracd -s --port 8000 --basic-auth="myproj,/home/git/trac/myproj/ .htpasswd,myproj" /home/git/trac/myproj