note 83877 added to function.socket-create
| From: | skellyatkeenio at osu1 dot php dot net | Date: | Mon, 16 Jun 2008 17:56:05 +0000 |
| Subject: | note 83877 added to function.socket-create | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-140508@lists.php.net to get a copy of this message | ||
It took some investigation to understand the bit about raw sockets requiring root access and raw
sockets being required to perform a seemingly simple "ping" on a Linux server. My source
of confusion was that the regular command line "ping" utility did not require me to be
root to exec it, so what was the difference? I found the answer starting with a forum posting to
look up
man 7 raw for raw sockets info which reveals:
"Only processes with an effective user ID of 0 or the CAP_NET_RAW capability are allowed to
open raw sockets."
So root is not the only way; the ping utility normally works because it has suid permission. There
is some interesting source code however that allows you to selectively assign the CAP_NET_RAW
capability without the need for suid. Use at your own risk, this is provided for informational
purposes only:
http://www.olafdietsche.de/linux/capability/
----
Server IP: 208.69.120.35
Probable Submitter: 12.111.93.250
----
Manual Page -- http://www.php.net/manual/en/function.socket-create.php
Edit -- https://master.php.net/note/edit/83877
Del: integrated -- https://master.php.net/note/delete/83877/integrated
Del: useless -- https://master.php.net/note/delete/83877/useless
Del: bad code -- https://master.php.net/note/delete/83877/bad+code
Del: spam -- https://master.php.net/note/delete/83877/spam
Del: non-english -- https://master.php.net/note/delete/83877/non-english
Del: in docs -- https://master.php.net/note/delete/83877/in+docs
Del: other reasons-- https://master.php.net/note/delete/83877
Reject -- https://master.php.net/note/reject/83877
Search -- https://master.php.net/manage/user-notes.php