linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] Let non-root users eject their ipods?
@ 2005-12-20  2:51 john stultz
  2005-12-20  3:51 ` Wakko Warner
                   ` (3 more replies)
  0 siblings, 4 replies; 30+ messages in thread
From: john stultz @ 2005-12-20  2:51 UTC (permalink / raw)
  To: lkml; +Cc: greg, axboe

All,
	I'm getting a little tired of my roommates not knowing how to safely
eject their usb-flash disks from my system and I'd personally like it if
I could avoid bringing up a root shell to eject my ipod. Sure, one could
suid the eject command, but that seems just as bad as changing the
permissions in the kernel (eject wouldn't be able to check if the user
has read/write permissions on the device, allowing them to eject
anything).

I've looked around trying to find some references to why this isn't
currently allowed or how safe this is, but I couldn't find anything
except the 2.6.8/k3b thread from awhile back and it didn't speak to why
eject would need root permissions even if the user has r/w permissions
on the device.

I really know nothing about scsi ioctls, so this is probably the wrong
solution, but I figured I'd offer my head upon a stake so others could
learn what not to do and why, and maybe start some discussion on what
the proper fix should be (for the kernel or the distributions to make)
since non root users really should be able to eject the flash disk they
just plugged in.

So below is a patch that allows non-root users to eject their ipods. (It
seems it should be safe_for_write() but eject opens the device for
RDONLY, so eject may be wrong here as well). 

Comments, flames?

thanks
-john

diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -188,6 +188,9 @@ static int verify_command(struct file *f
 		safe_for_write(GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL),
 		safe_for_write(GPCMD_LOAD_UNLOAD),
 		safe_for_write(GPCMD_SET_STREAMING),
+
+		/* let me eject my damn ipod */
+		safe_for_read(ALLOW_MEDIUM_REMOVAL),
 	};
 	unsigned char type = cmd_type[cmd[0]];
 



^ permalink raw reply	[flat|nested] 30+ messages in thread
[parent not found: <5lFTx-7L1-9@gated-at.bofh.it>]

end of thread, other threads:[~2005-12-24 21:18 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-20  2:51 [RFC] Let non-root users eject their ipods? john stultz
2005-12-20  3:51 ` Wakko Warner
2005-12-20  3:49   ` john stultz
2005-12-20  5:05     ` Matthew Dharm
2005-12-24 21:16   ` Jan Engelhardt
2005-12-20  5:18 ` Willy Tarreau
2005-12-20  6:06   ` Coywolf Qi Hunt
2005-12-20  8:56     ` Sander
2005-12-20  9:31       ` Coywolf Qi Hunt
2005-12-20  9:38         ` Sander
2005-12-20 16:39           ` Bill Davidsen
2005-12-20 11:10         ` Nikita Danilov
2005-12-20  7:46 ` Jens Axboe
2005-12-20 12:41   ` Ben Collins
2005-12-20 13:28     ` Jens Axboe
2005-12-20 13:32       ` Ben Collins
2005-12-20 13:39         ` Jens Axboe
2005-12-20 14:07           ` [PATCH] block: Better CDROMEJECT Ben Collins
2005-12-20 14:16             ` Jens Axboe
2005-12-20 20:41             ` john stultz
2005-12-20 20:54               ` Jens Axboe
2005-12-20 20:55                 ` john stultz
2005-12-20 20:58                   ` Jens Axboe
2005-12-20 20:58                     ` john stultz
2005-12-20 20:55               ` Ben Collins
2005-12-20 16:48           ` [RFC] Let non-root users eject their ipods? Bill Davidsen
2005-12-22 10:56 ` Alan Cox
2005-12-22 16:57   ` john stultz
2005-12-24 21:17   ` Jan Engelhardt
     [not found] <5lFTx-7L1-9@gated-at.bofh.it>
     [not found] ` <5lIeC-3hP-3@gated-at.bofh.it>
     [not found]   ` <5lIRn-4GE-19@gated-at.bofh.it>
     [not found]     ` <5lLw7-1f5-43@gated-at.bofh.it>
     [not found]       ` <5lM8s-2D4-1@gated-at.bofh.it>
     [not found]         ` <5lM8F-2D4-39@gated-at.bofh.it>
     [not found]           ` <5lSQE-87T-9@gated-at.bofh.it>
2005-12-20 20:21             ` Bodo Eggert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).