【问题标题】:selinux blocks user from listening ports < 32768 (no, it's > 1024)selinux 阻止用户监听端口 < 32768(不,它> 1024)
【发布时间】:2013-11-26 03:58:16
【问题描述】:

我在尝试启动 nodejs 服务器,发现它无法绑定端口 8000 或 8080、1234、12345....

Error: listen EACCES

如果我禁用 selinux (echo 0 > /selinux/enforce) 或者我以 root 身份运行它,它会起作用。

这是一个 nodejs 的东西吗? python -m SimpleHTTPServer 8000 也失败了。

socket.error: [Errno 13] Permission denied

然后我尝试了端口 54321,它可以工作,32768,工作,32767,不。 好的,所以 python 和 nodejs 都可以工作

the port > 32767

selinux disabled

has root privilege

node 和 python 都通过 yum install 安装到 /usr/bin。

-rwxr-xr-x. root root   system_u:object_r:bin_t:s0       node
-rwxr-xr-x. root root   system_u:object_r:bin_t:s0       python

哪个 selinux 政策导致了这种情况?

这是一个更新的 Centos 6.4 x64 最小盒子。

SELinux status:                 enabled
SELinuxfs mount:                /selinux
Current mode:                   enforcing
Mode from config file:          enforcing
Policy version:                 24
Policy from config file:        targeted

【问题讨论】:

    标签: linux centos selinux


    【解决方案1】:

    您可以尝试查看端口是否在 SELinux 中打开:

    semanage port -l | grep 8000
    

    如果它不在列表中,您可以尝试打开该端口:

    semanage port -a -t http_port_t -p tcp 8000
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-12-15
      • 2017-07-12
      • 1970-01-01
      • 2016-10-12
      • 1970-01-01
      • 2013-04-07
      相关资源
      最近更新 更多