# ceo@xxxxxxxxx / 2006-11-03 15:15:55 -0600: > On Fri, November 3, 2006 12:45 am, John.H wrote: > > My php program whose owner is root: That has absolutely no influence on what user the process *runs* as. > > <? > > mkdir('test',0777); > > ?> > > > > and the folder 'test' 's owner is 'nobody'? You're probably running this from a web server, and that often runs as nobody. Apache is typically started as root to allow it to listen(2) on port 80. This process running as root doesn't handle http requests itself, it fork(2)s, the child process switches its effective user id to nobody and then handles the request(s). > > why?should the folder belong to 'root' too? Filesystem nodes are owned by the effective user id of the process that created them. See chown(2), open(2), setuid(2) for details. > > By the way,the safe mode is turned on. That does not affect this. > I believe that the umask and other OS settings may also affect who > ends up owning a file created by 'root'... > http://php.net/umask Not at all. umask influences the mode ("permissions") of the created file, but is completely unrelated to ownership. > You're running this as CLI, right?... > > Cuz if you are running your web server as root, shut it down NOW. :-) See above. This is from a completely ordinary Apache 2.0 install: roman@ziggy ~ 1005:0 > ps auxww|grep httpd|head -5 root 6652 0.0 2.3 19108 11340 ?? Ss 10:30AM 0:00.93 /usr/local/sbin/httpd www 31670 0.0 2.6 20628 13028 ?? S 1:46PM 0:00.73 /usr/local/sbin/httpd www 34625 0.0 5.0 32260 24736 ?? S 2:09PM 0:00.68 /usr/local/sbin/httpd www 34734 0.0 2.9 21808 14200 ?? S 2:10PM 0:00.42 /usr/local/sbin/httpd www 34735 0.0 2.4 19672 12080 ?? S 2:10PM 0:00.24 /usr/local/sbin/httpd The root-owned process can be easily eliminated by running the server on a port > 1024 and natting it to 80. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php