3

I'd like to mount an ext3 filesystem via /etc/fstab so that the files in the mount are owned by a particular user. Is this possible ? I've looked at man mount but couldn't find an option to do this. ( Similar to setting uid and gid for a vfat mount ).

Is there any option besides doing running chown on the whole mounted filesystem ?

3 Answers3

2

No, this isn't possible to do in fstab or mount with ext3 because the ownership info is stored within the file system, as opposed to being a property of the file system. Run chown -R.

Adam Brand
  • 6,057
  • 2
  • 28
  • 40
2

As mentioned in an answer to this question, bindfs can be used to create a remapped mounting of a directory or filesystem with modified userid. This seems to work acceptably for me. I just did sudo bindfs -u myusername fs-mountpoint new-mountpoint and it happened. I'm not sure how well this will work in fstab, though, since bindfs is a FUSE filesystem.

intuited
  • 405
  • 1
  • 5
  • 12
1

There's a patch around for mounting ext2/3 with a fixed uid for all files, I couldn't figure out if it has made it into the kernel yet, but if it has it's in 2.6.31+ .

The option is anyway uid=userid, as in e.g. mount -o uid=500 /dev/sda1 /mnt/mydisk

It'll certainly be handy if you have removable drives formatted as ext3, moving it back& forth between machines where your have a different user id.

nos
  • 2,368
  • 3
  • 20
  • 24
  • Thanks, I'll have a look. I wanted this for the same reason you mentioned. –  Aug 02 '09 at 07:50
  • This still doesn't seem to work—I get a vague error message that lists, among other possible causes, bad mount option; the `uid=` option is not documented for ext* file systems. – intuited Nov 26 '15 at 17:19