Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to mount an ext3 file system from another linux installation so that the user, not root, will have full access to all the files. (I really do need user to have access to those files, because I would like to use them from another computer via sshfs, and sshfs will only give the user's access rights to the files.)

If I do mount /dev/sda1 /mnt/whatever all files are only accessible by root.

I've also tried mount -o nosuid,uid=1000,gid=1000 /dev/sda1 /mnt/whatever as instructed by a SuperUser question discussing ext4 but that fails with an error, and dmesg reports

EXT3-fs: Unrecognized mount option "uid=1000" or missing value

How can I do the mount?

share|improve this question
    
I'd say that Gilles' answer in the SuperUser question you mentioned is the correct one. Indeed, then man page mount(8) does not list uid=... and gid=... options for none of the ext2/3/4 filesystems. –  Riccardo Murri Jun 9 '11 at 11:26
    
@Riccardo Thanks, that was the correct solution! First mounting the ext into some directory regularly, then mounting that directory with bindfs -u $(id -u) -g $(id -g) into the final destination. Write it up as an answer, maybe? –  Ilari Kajaste Jun 9 '11 at 12:21
1  
Since the answer is Gilles' and he's very active on this forum as well, I'll leave it up to him to re-post it here and collect the deserved credit. –  Riccardo Murri Jun 9 '11 at 12:51

1 Answer 1

up vote 7 down vote accepted

On an ext4 filesystem (like ext2, ext3, and most other unix-originating filesystems), the effective file permissions don't depend on who mounted the filesystem or on mount options, only on the metadata stored within the filesystem.

If you have a removable filesystem that uses different user IDs from your system, you can use bindfs to provide a view of any filesystem with different ownership or permissions. The removable filesystem must be mounted already, e.g. on /mnt/sda1; then, if you want a particular user to appear as the owner of all files, you can run something like

mkdir /home/$user/sda1
bindfs -u $user -g $group /mnt/sda1 /home/$user/sda1
share|improve this answer
1  
Thanks for the solution! –  Ilari Kajaste Jun 10 '11 at 6:17
    
Thank you from me as well! With a little tweak, this also works for devices like e. g. hot-plugged SATA DVD-ROMs (which was the device I had problems with). HOWEVER, the device will always be mounted 000 for some reason (d---------) so you have to specify -p 700 to the bindfs line to access the files on the DVD via dolphin/nautilus etc., for instance. –  syntaxerror Nov 17 '13 at 23:27

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.