authind实现普通用户绑定80端口启动tomcat

一、安装authbind包
解压authbind_2.1.1.tar.gz
cd authbind-2.1.1


make 
返回结果:
cc -g -O2 -Wall -Wwrite-strings -Wpointer-arith -Wimplicit -Wnested-externs -Wmissing-prototypes -Wstrict-prototypes -DMAJOR_VER='"1"' -DMINOR_VER='"0"' -DLIBAUTHBIND='"/usr/local/lib/authbind/libauthbind.so.1"' -DHELPER='"/usr/local/lib/authbind/helper"' -DCONFIGDIR='"/etc/authbind"' -D_GNU_SOURCE  -c -o authbind.o authbind.c
cc -g  authbind.o   -o authbind
cc -g -O2 -Wall -Wwrite-strings -Wpointer-arith -Wimplicit -Wnested-externs -Wmissing-prototypes -Wstrict-prototypes -DMAJOR_VER='"1"' -DMINOR_VER='"0"' -DLIBAUTHBIND='"/usr/local/lib/authbind/libauthbind.so.1"' -DHELPER='"/usr/local/lib/authbind/helper"' -DCONFIGDIR='"/etc/authbind"' -D_GNU_SOURCE  -c -o helper.o helper.c
cc -g  helper.o   -o helper
cc -D_REENTRANT -g -O2 -Wall -Wwrite-strings -Wpointer-arith -Wimplicit -Wnested-externs -Wmissing-prototypes -Wstrict-prototypes -DMAJOR_VER='"1"' -DMINOR_VER='"0"' -DLIBAUTHBIND='"/usr/local/lib/authbind/libauthbind.so.1"' -DHELPER='"/usr/local/lib/authbind/helper"' -DCONFIGDIR='"/etc/authbind"' -D_GNU_SOURCE -c -o libauthbind.o -fPIC libauthbind.c
ld -shared -soname libauthbind.so.1 -o libauthbind.so.1.0 libauthbind.o -ldl -lc


make install 
返回结果:
install -o root -g root -m 755 -d /usr/local/lib/authbind /usr/local/share/man/man1 /usr/local/share/man/man8
install -o root -g root -m 755 -s authbind /usr/local/bin/.
install -o root -g root -m 644  libauthbind.so.1.0 /usr/local/lib/authbind/.
strip --strip-unneeded /usr/local/lib/authbind/libauthbind.so.1.0
ln -sf libauthbind.so.1.0 /usr/local/lib/authbind/libauthbind.so.1
install -o root -g root -m 755 -s helper /usr/local/lib/authbind/.
chmod u+s /usr/local/lib/authbind/helper
install -o root -g root -m 755 -d /etc/authbind \
                        /etc/authbind/byport /etc/authbind/byaddr /etc/authbind/byuid


二、普通用户使用authbind绑定80端口
1.创建80文件
cd /etc/authbind/byport
touch 80 
2.修改80文件的权限
chmod 755 80
3.修改80文件的拥有者和组群(chinavvv为普通用户)
chown chinavvv.chinavvv 80


三、普通用户使用80端口开启tomcat
启动命令之前加上authbind --deep,如:
使用普通用户启动tomcat,且tomcat使用80端口 
authbind --deep ./startup.sh




四、添加tomcat自启动
备注:用户和路径请根据实际情况设置
vi /etc/rc.d/rc.local
添加以下内容:
su - chinavvv -c "authbind --deep tomcat1/bin/startup.sh"
备注:用户名和路径请根据实际情况设置





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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值