Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 ?

share|improve this question
up vote 2 down vote accepted

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.

share|improve this answer

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.

share|improve this answer
    
Thanks, I'll have a look. I wanted this for the same reason you mentioned. – nagul 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

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.