Home > centOS, Fedora 12 > centOS – selinux port change

centOS – selinux port change

How to change port, and dont get this?

[root@www conf]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd: (13)Permission denied: make_sock: could not bind to address [::]:5061
(13)Permission denied: make_sock: could not bind to address
no listening sockets available, shutting down
Unable to open logs

1.enforcing or permissive [ we can put permissive, but please dont do that]

[root@www conf]# sestatus
SELinux status:                 enabled
SELinuxfs mount:                /selinux
Current mode:                   enforcing
Mode from config file:          enforcing
Policy version:                 21
Policy from config file:        targeted
[root@www conf]#

2.check the list SELinux want to accept

[root@www conf]# semanage port -l | grep http
http_cache_port_t              tcp      3128, 8080, 8118, 11211, 10001-10010
http_cache_port_t              udp      3130, 11211
http_port_t                    tcp      80, 443, 488, 8008, 8009, 8443
pegasus_http_port_t            tcp      5988
pegasus_https_port_t           tcp      5989
[root@www conf]#

3. vi httpd.conf

Listen 8008 # is allowed by SELinux 80 or 443 or 488 or 8008 or 8009 or 8443
# if you want to add a whole new one do this
# semanage port -a -t http_port_t -p tcp 5061

4. Done – restart the service

[root@www conf]# telnet localhost 80
telnet: connect to address Connection refused
telnet: Unable to connect to remote host: Connection refused
[root@www conf]# telnet localhost 8008
Connected to localhost.localdomain (
Escape character is ‘^]’.
<title>501 Method Not Implemented</title>
<h1>Method Not Implemented</h1>
<p>hello to / not supported.<br />
<address>Apache/2.2.3 (CentOS) Server at http://www..be Port 80</address>
Connection closed by foreign host.
[root@www conf]#

Categories: centOS, Fedora 12
  1. December 4, 2010 at 7:18 am

    Thxs buddy…
    Try this Url, looks gr8


  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: