Is there a way for non-root processes to bind to “privileged” ports on Linux?

后端 未结 24 1307
予麋鹿
予麋鹿 2020-11-22 02:04

It\'s very annoying to have this limitation on my development box, when there won\'t ever be any users other than me.

I\'m aware of the standard workarounds, but non

24条回答
  •  被撕碎了的回忆
    2020-11-22 02:46

    Bind port 8080 to 80 and open port 80:

    sudo iptables -t nat -A OUTPUT -o lo -p tcp --dport 80 -j REDIRECT --to-port 8080
    sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
    

    and then run program on port 8080 as a normal user.

    you will then be able to access http://127.0.0.1 on port 80

提交回复
热议问题