Linux normal users use the following 1024 port problem

Source: Internet
Author: User

Because the Linux kernel kernel code prohibits ordinary users from using ports below 1024, many times when we want to start using 80 ports of Apache, Nginx, or Tomcat as a normal user for security purposes, we are forbidden by permission.


Workaround:

Typically, the application uses more than 1024 ports and then forwards the 80 port to the corresponding program port using a firewall (hardware firewall or iptables), such as forwarding 80 to 8080 ports.


Iptables Add a forwarding rule:

#iptables-A prerouting-t nat-p tcp--dport 80-j REDIRECT--to-port 8080

Then save the forwarding rules to the configuration file

#service iptables Save


or modify the configuration file directly

#vim/etc/sysconfig/iptables

Add under the *nat key

-A prerouting-p tcp-m tcp--dport 80-j REDIRECT--to-ports 8080


Other than that:

It is not recommended to pass the chmod u+s way, so that there is a breach of the original purpose of security.


Linux normal users use the following 1024 port problem

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.