Trac登陆认证方式和权限设置

安装完trac后如果无法登陆可能就需要设置认证方式了

使用浏览器访问该trac时,页面上方也有一个“Login”连接,但是是无法使用的,点击了会报错,提示:
“Authentication information not available. Please refer to the installation documentation.”,则需要设置用户权限和登陆方式:

一 、创建用户并分配权限

  # trac-admin  /项目路径/  permission add  username TRAC_ADMIN

  # trac-admin  /项目路径/  permission list

eg: #trac-admin /home/yjl/trac permission add username TRAC_ADMIN 

# trac-admin /home/yjl/trac permission add username TRAC_ADMIN  


独立运行模式Running the Standalone Server下的认证方式

二、设置登陆方式

Tracd 提供两种认证方式: Basic and Digest authentication.

(一)、Digest authentication.

The Digest authentication is:

 $ tracd -p port --auth="base_project_dir,,realm" project_path 

where:

  • base_project_dir: the base directory of the project specified as follows:
    • when serving multiple projects: relative to the project_path
    • when serving only a single project (-s): the name of the project directory

Don't use an absolute path here as this won't work. Note: This parameter is case-sensitive even for environments on Windows.

  • password_file_path: path to the password file 可以用(安装apache后)htdigest命令生成密码文件
  • realm: the realm name (can be anything)
  • project_path: path of the project
  • --auth in the above means use Digest authentication, replace --auth with --basic-auth if you want to use Basic auth. Although Basic authentication does not require a "realm", the command parser does, so the second comma is required, followed directly by the closing quote for an empty realm name.

Examples:

 $ tracd -p 8080 \    --auth="project1,/path/to/passwordfile,mycompany.com" /path/to/project1 

Of course, the password file can be be shared so that it is used for more than one project:

 $ tracd -p 8080 \    --auth="project1,/path/to/passwordfile,mycompany.com" \    --auth="project2,/path/to/passwordfile,mycompany.com" \    /path/to/project1 /path/to/project2 

Another way to share the password file is to specify "*" for the project name:

 $ tracd -p 8080 \    --auth="*,/path/to/users.htdigest,mycompany.com" \    /path/to/project1 /path/to/project2 

(二)、Basic Authorization: Using a htpasswd password file

可以(安装apache后)使用htpasswd 生成密码文件

Note: It is necessary (at least with Python 2.6) to install the fcrypt package in order to decode some htpasswd formats. Trac source code attempt an import crypt first, but there is no such package for Python 2.6. Only SHA-1 passwords (since Trac 1.0) work without this module.

To create a .htpasswd file use Apache's htpasswd command (see below for a method to create these files without using Apache):

 $ sudo htpasswd  /path/to/env/ username 

then for additional users:

 $ sudo htpasswd /path/to/env/.htpasswd username2 

Then to start tracd run something like this:

 $ tracd -p 8080 --basic-auth="projectdirname,/fullpath/environmentname/.htpasswd,realmname" /fullpath/environmentname 

For example:

 $ tracd -p 8080 --basic-auth="testenv,/srv/tracenv/testenv/.htpasswd,My Test Env" /srv/tracenv/testenv 

Note: You might need to pass "-m" as a parameter to htpasswd on some platforms (OpenBSD)


Web Server 模式Running the Standalone Server下的认证方式

http://192.168.89.219:8080/trac/wiki/TracModWSGI#ConfiguringAuthentication

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值