Workaround for mounting a filesystem to a local directory without elevated privileges on Linux

I've got an ext3 filesystem sitting in a file, and I'd like to mount it to a local directory without sudo or any elevated permissions. Why? I'm creating a small filesystem for automated testing purposes. The automated tests run on machines I do not control, so there are some barriers to adding mount to sudoers.

Here's how I created the filesystem:

$ dd if=/dev/zero of=./50MB_partition count=102400
$ mkfs.ext3 -F 50MB_partition

Had I had permission, I could now mount it like so:

$ mkdir small_partition
$ sudo mount 50MB_partition ./small_partition

It seems that, because I own the filesystem and the mount point, there is no security risk associated with allowing me to mount this. I understand what is limiting me from calling mount without sudo; no explanation needed there. What I want to know is, is there a workaround that allows me to use my filesystem for testing purposes?


Solution 1:

mount requires mount() [defined in sys/mount.h] which, in turn, requires CAP_SYS_ADMIN, so you can't use mount() without a fstab entry or sudo.

might want to look into fuse (filesystem in userspace) [ http://fuse.sourceforge.net/ ]