LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-07-2010, 09:04 AM   #1
licks0re
LQ Newbie
 
Registered: Nov 2010
Posts: 2

Rep: Reputation: 0
Question apache user cannot bind a port


Hi there,

I have a problem on a 5.5 centos.


I want to run a soft that is daemonized, and listens on port 6789.
This soft is launched through a php page, so, by the apache user.
The problème is that the apache user does not has rights to open / listen on a port.

I tried to add apache user to the root group, but it won't help.
In the application log, I have this every second :


(...)
Sat Nov 6 13:30:13 2010 ERROR Binding socket failed for 127.0.0.1: Err
No 13, Permission denied
Sat Nov 6 13:30:14 2010 ERROR Binding socket failed for 127.0.0.1: Err
No 13, Permission denied
(...)

etc etc etc.

I tried to add apache user in the sudoers with a nopasswd but it's still a no go.

That is it! Any info, ideas, etc will be more than welcome!

Thanks a lot,
licks0re
 
Old 11-07-2010, 11:05 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

Since you're running Centos, I guess it's SELinux that's not allowing the apache user to open port 6789.
You can run:
Code:
sestatus
to see if that's the case and if yes, either set SELinux to permissive mode, or run:
Code:
semanage port -a -t http_port_t -p tcp 6789
to allow apache user to open that port.

Regards
 
1 members found this post helpful.
Old 11-07-2010, 11:25 AM   #3
licks0re
LQ Newbie
 
Registered: Nov 2010
Posts: 2

Original Poster
Rep: Reputation: 0
Hi Bathory,

Awesome, that's working now.
I must admint I have to check how selinux works. I'm usually using opensuse and I'm quite new to centos.

Well, it's working perfectly, thanks a million!
 
Old 11-07-2010, 11:35 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Glad to see it worked.
You can mark the thread Solved using the "Thread Tools" on top of the page.

Cheers
 
Old 11-08-2010, 12:10 AM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,356

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
This covers RHEL, therefore Centos, inc a lot about SELinux http://www.linuxtopia.org/online_boo...ion/index.html
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Does SELinux allow Non-root user bind to port <1024 suddenlyalice Linux - Security 4 10-26-2010 04:59 AM
need permission for apache-launched daemon to bind on port under 1024 sneakyimp Programming 2 05-05-2009 08:56 PM
Can I bind to a serial port using BIND Socket API?? venkat_p257 Linux - General 2 12-04-2007 05:49 AM
"apache startssl" fails: can't bind port 443 mrjamin Linux - Software 4 07-04-2005 11:09 AM
Bind Port dvong3 Linux - Networking 2 05-14-2004 03:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration