Ubuntu – Mounting Directories with bind & different permissions


I’m running Ubuntu 13.04 & trying to mount a folder using bind in /etc/fstab. Shown below is one of many similar entries;

/media/Storage1/test   /media/Storage1/WebDAV/Alex     none    bind,uid=www-data,gid=alex    0       0

The directory is mounted upon startup and if I navigate to either of these directories the files are matched. The issue I have is that the permissions are not changed!!!

In the above example (/media/Storage1)

  • /test is owned by root:root
  • /WebDAV/Alex is owned by www-data:alex

However when mounted, /media/Storage1/WebDAV/Alex is now root:root

The same is the case for all my directories mounted in this way (root is not the only owner of original directory, additionally I have tried uid=33,gid=1000)

Am I using bind incorrectly? Am I doing something hideously wrong?

Best Answer

  • The bind option is not a real filesystem and does not support the uid and gid parameters. Specify the user or owner option to get the desired effect.

    $ ll /tmp/moo/ -d
    drwxr-xr-x 2 root root 40 Jul 24 01:07 /tmp/moo/
    $ mount /tmp/moo
    $ ll /tmp/moo/ -d
    drwxr-xr-x 42 jaroslav jaroslav 4096 Jul 24 01:05 /tmp/moo/
    $ grep bind,user /etc/fstab
    /home/jaroslav/tmp /tmp/moo none bind,user      0 0
  • Related Question