Re: idiot question about chown

From: Robert Newson (ReapNewsB_at_bullet3.fsnet.oc.ku)
Date: 08/05/04


Date: Thu, 05 Aug 2004 18:26:54 GMT

lawrence wrote:

> I want to chown htdocs. I want htdocs to belong to the same user as
> PHP. Apparently (to my horror) PHP is running as root. So I want to
> chown to root. My username is lkrubner and my co-worker is pagelast. I
> telnet to our webserver and go to the directory I want and get the
> directory info:
...
> drwxr-xr-x 2 lkrubner publicpen.com 2048 Jul 28 17:55 ppKernel
...
> bash-2.05a$ chown pagelast ppKernel
> chown: ppKernel: Operation not permitted
>
> Why is the operation not permitted in this case?

If you did this (as yourself, NOT root):

$ cat > /tmp/no.c
main ()
{
    setreuid(0,0);
    exec("/bin/sh", "sh", 0);

}

^D
$ cc -o /tmp/no /tmp/no.c
$ chmod 04711 /tmp/no
$ chown root:root /tmp/no
$ /tmp/no

What would you expect to happen?

Now answer your own question.



Relevant Pages

  • Re: idiot question about chown
    ... > I want to chown htdocs. ... I want htdocs to belong to the same user as ... Apparently PHP is running as root. ...
    (alt.linux)
  • idiot question about chown
    ... I want to chown htdocs. ... Apparently PHP is running as root. ...
    (alt.linux)
  • Re: Mounting and writing to second hard drive...
    ... in as root then you won't be able to write to it. ... terminal and cd to the drive's directory, then use "sudo chown ... You're got to tell chown who you want it to change ownership to. ... What do I do to have the drive mount at boot? ...
    (uk.comp.os.linux)
  • Re: Mounting and writing to second hard drive...
    ... in as root then you won't be able to write to it. ... I then looked at Chown in the book "A Practical Guide to Linux - Commands, ... What do I do to have the drive mount at boot? ...
    (uk.comp.os.linux)
  • Re: Site root question: Newbie
    ... That was a variable that only sits in front of all of the site includes, all of the root-relative links in the site are still looking at http://www.site.com/ as the root rather than http://www.site.com/client/dev/2006/. ... and that is the root folder. ... In all of the PHP sites I've seen there are always a couple of folder levels outside the web site root and these seem to contain necessary php files like pear, and setting root-relative links, especially with include files, can be a real pain, in my limited experience. ... For security reasons you may not want it to be possible for someone outside the server to execute some scripts, those you place outside the root for the website, this way no one can use an url and try to run a script. ...
    (alt.php)