Hi, I have been using pmount to mount a usbkey formatted as ext3. I recently bought a mp3 player with 1GB and I thought desirable to use it instead of my 64MB key. However the player uses VFAT, so I couldn't use UNIX file permissions (which is a PITA). I came up with having a fs in a file inside the VFAT fs. But then you can't use pmount and you have to be root to mount it (correct me if I am wrong). I think it would be desirable to be able to mount loop devices as a regular user. For that, several things have to be fixed: 1. /dev/loop* need to have a group different that 'disk'. 'plugdev', for example. 2. /dev/loop* need to be included in /etc/pmount.allow, or change linux so /sys/block/loop*/removable is 1 instead of 0 (I think this is the best solution). 3. pmount would have to be changed so if the parameter is a file instead of a device, do something similar to: /sbin/losetup /dev/loop0 fs.img And then use /dev/loop0 as a normal device and mount it in /dev/fs.img Probably what I am proposing is crazy (since I haven't thought about security, etc...), but I can't see why this is not possible with the current system. I am motivated to do the changes myself (I don't think it's difficult, all of them seem one-liners), if nobody sees any problem. Thanks Pablo
After looking into udev rules, I realized that if /sys/block/loop*/removable is 1, point 1 is automatically solved as well. Cheers, Pablo
Ok. I thought better about it and maybe changing the kernel is not an option. I almost-solved adding an udev rule like this: KERNEL=="loop[0-9]*", GROUP="plugdev" and than add this patch to pmount:--- pmount-0.9.11/src/policy.c 2006-05-11 18:20:20.000000000 +0100 +++ pmount-0.9.11-loop-devices/src/policy.c 2006-06-16 14:54:38.000000000 +0100 @@ -23,6 +23,8 @@ #include <sysfs/libsysfs.h> #include <regex.h> +#include <grp.h> + /************************************************************************* * * Sysfs query functions for determining if a device is removable @@ -370,6 +372,18 @@ device_removable( const char* device ) int removable; char blockdevpath[PATH_MAX]; + /* if the group is 'plugdev', treat is as removable */ + if ( !removable ) { + struct stat dev_stat; + struct group *plugdev_group; + stat (device, &dev_stat); + plugdev_group = getgrnam("plugdev"); + if ( dev_stat.st_gid == plugdev_group->gr_gid ) { + removable = 1; + } + return removable; + } + dev = find_sysfs_device( device, blockdevpath, sizeof( blockdevpath ) ); if( !dev ) { debug( "device_removable: could not find a sysfs device for %s\n", device ); The only bit that remains is changing pmount so if it detects a regular file, it executes: dev = $(losetup -f) losetup $dev $file and continues as normal. But first I would like a bit of feedback from someone... The previous patch feels a bit dirty and maybe someone knows better. Thanks Pablo
Hi Pablo, Pablo Barbachano [2006-06-14 12:20 +0100]: Indeed, that is already a long standing item on my list. I hope to be able to solve this soon. Not necessarily. pmount does not care about groups of device nodes, and I do not think it is a good idea to start doing so (since every distro handles groups in an different manner). Neither is necessary. Indeed, this is not complicated at all, and this is what I'm going to do when I implement this. It's not that crazy, but we have to pay attention to not cause a DoS due to loop device exhaustion. There are only 8 loop devices available, so as long as the kernel imposes this restriction, and a normal user should not be able to use up all of them. In general, I think using an approach that avoids mounting entirely would be a better alternative (like Gnome's file-roller, which can browse CD ISO images already). I'll think about this some more. Thanks, Martin
We believe that the bug you reported is fixed in the latest version of
pmount, which is due to be installed in the Debian FTP archive:
pmount_0.9.99-alpha-1.debian.tar.gz
to main/p/pmount/pmount_0.9.99-alpha-1.debian.tar.gz
pmount_0.9.99-alpha-1.dsc
to main/p/pmount/pmount_0.9.99-alpha-1.dsc
pmount_0.9.99-alpha-1_amd64.deb
to main/p/pmount/pmount_0.9.99-alpha-1_amd64.deb
pmount_0.9.99-alpha.orig.tar.bz2
to main/p/pmount/pmount_0.9.99-alpha.orig.tar.bz2
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to 373580@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Vincent Fourmond <fourmond@debian.org> (supplier of updated pmount package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)
Format: 1.8
Date: Fri, 25 Mar 2011 20:03:07 +0100
Source: pmount
Binary: pmount
Architecture: source amd64
Version: 0.9.99-alpha-1
Distribution: experimental
Urgency: low
Maintainer: Vincent Fourmond <fourmond@debian.org>
Changed-By: Vincent Fourmond <fourmond@debian.org>
Description:
pmount - mount removable devices as normal user
Closes: 373580 431286 488627 513431 542779 615979 616019
Changes:
pmount (0.9.99-alpha-1) experimental; urgency=low
.
* New upstream experimental release, bringing in a lot of new features:
- fscking (closes: #513431, #488627, #542779, since all of these bugs,
though different, come from the impossibility to run fsck on a
filesystem before mounting)
- now by default forbidding mounts by users not physically logged in,
which prevents mount races (closes: #431286)
- whitelisting firewire (closes: #616019)
- checking the sanity of the target device before attempting to mount
it, which in particular prevents long errors with a 'no medium found'
error (closes: #615979)
- finally opening the possibility to mount user images through loop
devices (closes: #373580)
* Added a news entry about the new configuration file
* Update watchfile to accept -alpha in the release number
Checksums-Sha1:
9ed59692d333c2fda0377d33a3b8775112721e9c 1178 pmount_0.9.99-alpha-1.dsc
091ab70d85bf2c62013134b23a16acb363b63777 364282 pmount_0.9.99-alpha.orig.tar.bz2
9632aaec04f47c1b0be7716ee35efd8a15914170 11722 pmount_0.9.99-alpha-1.debian.tar.gz
5e5627a1d24aa073974f2eec90c15775f3a37daa 122338 pmount_0.9.99-alpha-1_amd64.deb
Checksums-Sha256:
7598131515c01a56c79fc83c8d0d974a790afb810f7923ad5eafed24d849c1c3 1178 pmount_0.9.99-alpha-1.dsc
ca06bd0c429d3db9382433f378d07bf763534f70fe71015322678e321b0679e5 364282 pmount_0.9.99-alpha.orig.tar.bz2
d3ec949de9b0ce4f0a9c5c4fd6e131c9458aa48848f9075f06f84b2aaf516e1b 11722 pmount_0.9.99-alpha-1.debian.tar.gz
4ee6d57b6cc623b83289196a7f549e9f4a0249e68e4d56320c772ff0a81cda12 122338 pmount_0.9.99-alpha-1_amd64.deb
Files:
5020189869b2102d7dfc99f4a6885215 1178 utils optional pmount_0.9.99-alpha-1.dsc
39bfeb1d3aa80ffec06c39ac9c62769e 364282 utils optional pmount_0.9.99-alpha.orig.tar.bz2
38e413f9539357fd3f5c7d959878908f 11722 utils optional pmount_0.9.99-alpha-1.debian.tar.gz
d8302a0fa7185a8f5d302effaa034784 122338 utils optional pmount_0.9.99-alpha-1_amd64.deb
iEYEARECAAYFAk2M6cgACgkQx/UhwSKygsp3rACfeUmyZE1T5sA5YUYVvb+XTsOt
AGMAnAhNyNENEKlsyUg3vVhTqzwhDBuS
=f8iM
-----END PGP SIGNATURE-----
We believe that the bug you reported is fixed in the latest version of
pmount, which is due to be installed in the Debian FTP archive:
pmount_0.9.99-alpha-1.debian.tar.gz
to main/p/pmount/pmount_0.9.99-alpha-1.debian.tar.gz
pmount_0.9.99-alpha-1.dsc
to main/p/pmount/pmount_0.9.99-alpha-1.dsc
pmount_0.9.99-alpha-1_amd64.deb
to main/p/pmount/pmount_0.9.99-alpha-1_amd64.deb
pmount_0.9.99-alpha.orig.tar.bz2
to main/p/pmount/pmount_0.9.99-alpha.orig.tar.bz2
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to 373580@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Vincent Fourmond <fourmond@debian.org> (supplier of updated pmount package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)
Format: 1.8
Date: Fri, 25 Mar 2011 20:03:07 +0100
Source: pmount
Binary: pmount
Architecture: source amd64
Version: 0.9.99-alpha-1
Distribution: experimental
Urgency: low
Maintainer: Vincent Fourmond <fourmond@debian.org>
Changed-By: Vincent Fourmond <fourmond@debian.org>
Description:
pmount - mount removable devices as normal user
Closes: 373580 431286 488627 513431 542779 615979 616019
Changes:
pmount (0.9.99-alpha-1) experimental; urgency=low
.
* New upstream experimental release, bringing in a lot of new features:
- fscking (closes: #513431, #488627, #542779, since all of these bugs,
though different, come from the impossibility to run fsck on a
filesystem before mounting)
- now by default forbidding mounts by users not physically logged in,
which prevents mount races (closes: #431286)
- whitelisting firewire (closes: #616019)
- checking the sanity of the target device before attempting to mount
it, which in particular prevents long errors with a 'no medium found'
error (closes: #615979)
- finally opening the possibility to mount user images through loop
devices (closes: #373580)
* Added a news entry about the new configuration file
* Update watchfile to accept -alpha in the release number
Checksums-Sha1:
9ed59692d333c2fda0377d33a3b8775112721e9c 1178 pmount_0.9.99-alpha-1.dsc
091ab70d85bf2c62013134b23a16acb363b63777 364282 pmount_0.9.99-alpha.orig.tar.bz2
9632aaec04f47c1b0be7716ee35efd8a15914170 11722 pmount_0.9.99-alpha-1.debian.tar.gz
5e5627a1d24aa073974f2eec90c15775f3a37daa 122338 pmount_0.9.99-alpha-1_amd64.deb
Checksums-Sha256:
7598131515c01a56c79fc83c8d0d974a790afb810f7923ad5eafed24d849c1c3 1178 pmount_0.9.99-alpha-1.dsc
ca06bd0c429d3db9382433f378d07bf763534f70fe71015322678e321b0679e5 364282 pmount_0.9.99-alpha.orig.tar.bz2
d3ec949de9b0ce4f0a9c5c4fd6e131c9458aa48848f9075f06f84b2aaf516e1b 11722 pmount_0.9.99-alpha-1.debian.tar.gz
4ee6d57b6cc623b83289196a7f549e9f4a0249e68e4d56320c772ff0a81cda12 122338 pmount_0.9.99-alpha-1_amd64.deb
Files:
5020189869b2102d7dfc99f4a6885215 1178 utils optional pmount_0.9.99-alpha-1.dsc
39bfeb1d3aa80ffec06c39ac9c62769e 364282 utils optional pmount_0.9.99-alpha.orig.tar.bz2
38e413f9539357fd3f5c7d959878908f 11722 utils optional pmount_0.9.99-alpha-1.debian.tar.gz
d8302a0fa7185a8f5d302effaa034784 122338 utils optional pmount_0.9.99-alpha-1_amd64.deb
iEYEARECAAYFAk2M6cgACgkQx/UhwSKygsp3rACfeUmyZE1T5sA5YUYVvb+XTsOt
AGMAnAhNyNENEKlsyUg3vVhTqzwhDBuS
=f8iM
-----END PGP SIGNATURE-----