I think you got the answer to your main question. So let me answer on how I did the same thing. And perhaps some ideas on how to get around your issues.
First, I don't bother dropping the modules. In fact, I just put them in to always load during boot, and then forget about it. (Actually, since moving to Gentoo, I just compiled 'em right into the kernel so they aren't modules anymore.) Then I set /mnt/camera to be mountable by non-root by adding ",user" to the options string. In your case, that would be /mnt/usb/flash.
Next option would be to have a load/unload script, say, /usr/local/bin/mount_flash, which just was:
Then add this to /etc/sudoers such that you can run it without a password:#!/bin/sh unmount=$1 if [ $unmount = "-d" ] then /sbin/umount /mnt/usb/flash sleep 2 /sbin/modprobe -r usb-storage else /sbin/modprobe usb-storage /sbin/mount /mnt/usb/flash fi
(I think), and now just run system(qw(sudo /usr/local/bin/mount_flash)) and system(qw(sudo /usr/local/bin/mount_flash -d)). Completely avoiding setuid().alaric NOPASSWD: /usr/local/bin/mount_flash, /usr/local/bin/mount_flas +h -d
In reply to Re: An odd failure of setuid(0)
by Tanktalus
in thread An odd failure of setuid(0)
by Llew_Llaw_Gyffes
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |