The problem isn't with eject; eject is working properly... I think. The
permissions for /dev/sdb1 (on my machine, that's the first USB disk's
ID) are 660, and it's owned by root:disk. I can add myself to the 'disk'
group, but that gives me raw access to any fixed disk on the system, and
I don't think that's a permission that should be tightly bound to being
able to safely remove a USB stick.

I don't think that eject should be suid root; Ubuntu manages permissions
for access to the CD drive by users being in group 'cdrom', and the CD
device being mode 660, owned by root:cdrom. The following bit suggests
that the disk should belong to the 'root:plugdev' group, which the
standard config tools *do* provide access for.

http://qblog.remarqs.net/2008/05/13/usb-drive-annoyance-with-kde-and-
udev/

If I make USB drive owned by group 'plugdev', I can easily eject it:

$ sudo chown root:plugdev sdb sdb1
$ ls sd* -ld
brw-rw---- 1 root disk    8,  0 2008-11-24 13:43 sda
brw-rw---- 1 root disk    8,  1 2008-11-24 13:43 sda1
brw-rw---- 1 root disk    8,  2 2008-11-24 13:43 sda2
brw-rw---- 1 root disk    8,  5 2008-11-24 13:43 sda5
brw-rw---- 1 root plugdev 8, 16 2009-01-06 13:48 sdb
brw-rw---- 1 root plugdev 8, 17 2009-01-06 13:48 sdb1
$ eject -v sdb1
eject: device name is `sdb1'
eject: expanded name is `/dev/sdb1'
eject: `/dev/sdb1' is mounted at `/media/disk'
eject: unmounting device `/dev/sdb1' from `/media/disk'
eject: `/dev/sdb1' is a multipartition device
eject: trying to eject `/dev/sdb1' using CD-ROM eject command
eject: CD-ROM eject command succeeded

On the other hand, according to bug 128257, the 'plugdev' group is
deprecated, since the above configuration means that anyone on the
system with plugdev privileges has full access to the USB stick. Perhaps
the best solution would be to create the device node either chown'd to
or chgrp'd to the primary group of the user on whose behalf it's
mounted... but then again, not all USB storage is attached solely for
the benefit of a single user, and some *should* actually be chown'd
root:disk like any internally-attached device would be.

So perhaps the problem is that the system is mounting the USB drive with
bad permissions... and perhaps the problem is that eject shouldn't be
trying to run 'eject' commands on USB sticks--does the 'eject' command
actually do anything that simply unmounting the device doesn't, or is it
only sensible for USB-attached optical drives? I'm adding a hal task in
case it's their issue, and marking both tasks 'new' for now.

** Changed in: eject (Ubuntu)
       Status: Incomplete => New

-- 
eject command fails with "unable to open" error
https://bugs.launchpad.net/bugs/235202
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to