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 ?

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.

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.

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.

2
  • Thanks, I'll have a look. I wanted this for the same reason you mentioned. – user14852 Aug 2 '09 at 7: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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy