首页 > 其他 > 详细

非root用户无法启动监听80端口的Tomcat

时间:2016-07-09 18:01:51      阅读:300      评论:0      收藏:0      [点我收藏+]

一、问题

网站绑定域名后直接通过域名访问使用的是80端口,因此tomcat须监听80端口。而为了安全起见tomcat一般不用root身份运行,因此需要以普通用户来运行监听80端口的root。此时就会启动失败,报没有权限,因为只有root身份才能监听1024以内的熟知端口。

二、解决

(以下未经验证)

There are a few different solutions to work around this:

  1. Install and configure Apache or nginx as a reverse proxy server, which can be started as root to open the port, and then downgrade its privileges back to a normal user.
  2. Set up a firewall on the server using iptables or an alternative, so that the lower port number is forwarded internally to a higher port number listened by Confluence.
  3. Use jsvc, which is able to open ports as root, and then downgrade privileges.
  4. Use authbind to grant privileges for a non-root user to open a privileged port.

1、通过iptables进行端口转发

以8080(其他非熟知端口皆可)端口启动,直接执行 iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080  做端口转发。

参考资料:linux配置本地tomcat应用80端口转发

2、通过isvc

jsvc能以root角色使用端口,因此借助之即可。另外,这种方式也把tomcat做成了服务,能够开机自己启动。

 

非root用户无法启动监听80端口的Tomcat

原文:http://www.cnblogs.com/z-sm/p/5656202.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!