note 73113 added to function.posix-setuid

From: Date: Fri, 09 Feb 2007 12:16:41 +0000
Subject: note 73113 added to function.posix-setuid
Groups: php.notes 
Request: Send a blank email to php-notes+get-123169@lists.php.net to get a copy of this message
On many UNIX systems (tested on Debian GNU/Linux), SUID is disabled for scripts and works only for binaries. If you need to setuid, you must use a wrapper binary that runs setuid() php script. Here's an example: $ nano suexec.cpp #include <stdlib> using namespace std; int main() { system("php /home/php/php_user.php"); return 0; } $ g++ -o suexec suexec.cpp $ sudo chown root:root suexec $ sudo chmod 4755 root Then we create short PHP script to set process uid (you should already know how to do this). Don't even try to experiment with auto_prepend_file in php.ini, it doesn't work as expected. ---- Server IP: 195.136.184.34 Probable Submitter: 84.10.81.119 ---- Manual Page -- http://www.php.net/manual/en/function.posix-setuid.php Edit -- https://master.php.net/note/edit/73113 Del: integrated -- https://master.php.net/note/delete/73113/integrated Del: useless -- https://master.php.net/note/delete/73113/useless Del: bad code -- https://master.php.net/note/delete/73113/bad+code Del: spam -- https://master.php.net/note/delete/73113/spam Del: non-english -- https://master.php.net/note/delete/73113/non-english Del: in docs -- https://master.php.net/note/delete/73113/in+docs Del: other reasons-- https://master.php.net/note/delete/73113 Reject -- https://master.php.net/note/reject/73113 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#123169) next »