#135 Wrong directory permissions set when mounting a FAT32 disk

9.1.0.1
open
nobody
None
1
2014-08-06
2013-10-08
systemservice
No

If I mount a FAT32 disk using GUI with my custom user "backup" and group "backup" to "/mnt/backup", then the destination directy is mounted as user "root" and group "wheel". If I mount an UFS disk, then it works correctly (user "backup" and group "backup").

Currently I'm using a dirty hack in a custom script as a workaround:

        $mountname = "{$g['media_path']}/{$mount['sharename']}";
        @rmdir($mountname);
        @mkdir($mountname, $mount['accessrestrictions']['mode']);
        @chmod($mountname, octdec($mount['accessrestrictions']['mode']));
        @chown($mountname, $mount['accessrestrictions']['owner']);
        @chgrp($mountname, $mount['accessrestrictions']['group']);
        disks_mount($config['mounts']['mount'][0]);

But it would be better to fix this problem in the file "disks.inc" -> function disks_mount($mount), line 175:

Original code:
case "msdosfs":
$result = mwexec("/sbin/mount -t msdosfs -o large {$readonly} {$devicespecialfile} '{$mountname}'", true);

Bugfix:
Do something like this before calling "$result = mwexec("/sbin/mount -t msdosfs...":

        @mkdir($mountname, $mount['accessrestrictions']['mode']);
        @chmod($mountname, octdec($mount['accessrestrictions']['mode']));
        @chown($mountname, $mount['accessrestrictions']['owner']);
        @chgrp($mountname, $mount['accessrestrictions']['group']);

Regards,
Arthur.

Discussion