Mounting Ext3 Filesystem – How to Mount with User Privileges

ext3mountusers

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 run 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 mount the filesystem?

Best Answer

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
Related Question