用Authbind 解决普通用户占用80端口问题
1. Authbind
Wiki:http://en.wikipedia.org/wiki/Authbind
目前 CentOS 下没有RPM, 只能编译安装。
源码: http://www.chiark.greenend.org.uk/ucgi/~ijackson/cvsweb/authbind/
【2013-12】更新: http://download.csdn.net/detail/maoxiang/6777219 原始地址不能下载了,我放到这里了
2. 编译 & 安装
由于 CentOS的默认执行目录是 /usr/bin ,修改 Makefile 中的设置 将 prefix=/usr/local 改成 prefix=/usr
在 root 状态下 make & make install
3. 配置
如果是用户 test 需要占用80端口。
touch /etc/authbind/byport/80
chmod 500 /etc/authbind/byport/80
chown test /etc/authbind/byport/80
4. 启动应用
启动命令之前加上
authbind –deep
如果是Nginx:daemon authbind –deep
nginxd−c
{nginx_config}
如果是Java: authbind –deep java ….
或者直接在tomcat启动文件startup.sh中加上(最后一行):
exec authbind –deep “
PRGDIR"/"
EXECUTABLE” start “$@”