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?
>
>
> TIA,
> Oliver
>
>
>
> php code:
>
> ...
> umask (0002);
> if(is_uploaded_file($userfile) && move_uploaded_file($userfile,
> $file_name))
> ..
>
> result on seperate bind mount:
> drwxrwsr-x 2 www-data wdvuser 4096 2007-06-26 13:54 .
> drwxrwsr-x 7 ftp wdvuser 4096 2007-06-26 09:20 ..
> -rw-rw-r-- 1 www-data wdvuser 5253 2007-06-26 13:54 logo.jpg
>
>
> result on root fs (/dev/hdv1, ufs):
> drwxrwsr-x 2 www-data wdvuser 4096 2007-06-26 14:39 .
> drwxr-xr-x 6 root root 4096 2007-06-26 14:37 ..
> -rw------- 1 www-data www-data 3624 2007-06-26 14:39 logo.jpg
>
>
>
>
>
> mount output:
> /dev/hdv1 on / type ufs (defaults)
> /var/www/test type none (0)
>
>
>
> fstab:
> none /proc proc defaults,noexec,nosuid 0 0
> none /dev/pts devpts gid=5,mode=620 0 0
> /srv/www/test /var/www/test none bind
>
>
> Versions:
> Kernel: 2.6.19.7-grsec2.1.10-vs2.2.0
> VS-API: 0x00020200
> util-vserver: 0.30.212; Jan 16 2007, 11:59:37
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...
-- Daniel Hokka Zakrisson _______________________________________________ Vserver mailing list Vserver@list.linux-vserver.org http://list.linux-vserver.org/mailman/listinfo/vserverReceived on Wed Jun 27 15:55:09 2007