On Wednesday 27 June 2007 15:45:36 Daniel Hokka Zakrisson wrote:
> Oliver Heinz wrote:
> > Hi,
> >
> > after some testing it seems that I have some strange behaviour with the
> > root
> > fs in guests.
> >
> > I have an apache 1.3 running, with php4 scripts that do an file upload
> > to the
> > filesystem. I wanted to change the umask for file creation and had
> > different
> > behaviour for the resulting file being on the root fs (/dev/hdv1 which
> > shows
> > as via mount ufs) and a seperate bind mount.
> >
> > When the file ist created on the seperate mount umask works and i can set
> > whatever umask i want resulting in the corresponing mode.
> >
> > When the file is created somewhere on the / ufs it's created with with
> > mode
> > 0600, no matter what umask I set - it's just completely ignored, SGID is
> > also
> > ignored the resulting file is owned by the primary group of the
> > apache-process.
> >
> > chmod in php does work fine, umask on the commanline does work too.
> >
> > Has anybody ever experienced such strange behaviour?
...
>
> Sounds to me like the file is originally on the root filesystem, e.g. in
> /tmp, and move_uploaded_file is optimized to simply rename(2) the file if
> the source and destination are on the same filesystem, which would mean
> that the umask isn't used at all. An strace should tell you more though...
Thanks!! I was so focused on "why is umask broken" that i did not think
about "when is umask applied and when not". Now that I use a tmpfs for
the /tmp it is a move across filesystems and umask and sgid are applied - but
applications should not probably not rely on this, so we have to use
chmod/chown to enforce the desired bahaviour.
So again, thanks a lot!
Oliver
_______________________________________________
Vserver mailing list
Vserver@list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver
Received on Thu Jun 28 11:17:01 2007