[CentOS] UDEV rule allow users to unmount USB stick

Robert kerplop at sbcglobal.net
Tue Dec 23 14:39:25 UTC 2008



Lanny Marcus wrote:
> On Mon, Dec 22, 2008 at 8:46 PM, MHR <mhullrich at gmail.com> wrote:
>   
>> On Mon, Dec 22, 2008 at 4:19 PM, Philip Manuel <phil at zomojo.com> wrote:
>>     
>>> I'm trying to understand why a normal user is not allowed to unmount
>>> their USB stick?  I think it is most likely a udev rule.  does anyone know ?
>>>       
>
>   
>> If I understand this correctly, it's a mount/umount rule - normal
>> users cannot run root commands.  They are written to disallow normal
>> users from performing root tasks.
>>
>> However, if you are using gnome, you can use the gnome-umount command
>> (which is the equivalent of right-clicking the icon and selecting
>> "Unmount").  I suspect there is a similar analogue in KDE.
>>     
>
> Good explanation Mark. I use GNOME and I have zero problems with this. Lanny
>   
Mark's assumption was correct.  In KDE, the right-click menu item is 
"Safely remove".  I find it interesting, though, that root can manually 
mount a USB drive from the command line and any user can "safely remove" 
it via KDE. For example, I have this line in my fstab for a backup hard 
drive

        LABEL=OT3               /media/OT3              ext3   
        noauto,user,rw

Normally, it's mounted and unmounted by the backup script but I 
discovered that if root manually mounts it

        [root at mavis ~]# mount /media/OT3
        [root at mavis ~]# mount
        <snip>
         /dev/sda1 on /media/OT3 type ext3 (rw,noexec,nosuid,nodev)
        [root at mavis ~]#                               

And I try to unmount it as my normal user, I run into the behavior that 
is spelled out in the man page:

        [rj at mavis ~]$ umount /media/OT3
        umount: only root can unmount LABEL=OT3 from /media/OT3
        [rj at mavis ~]$      

However, I CAN unmount it using KDE. --*USUALLY*--
Occasionally, the desktop icon will indicate "unmounted" but either 
attempting to mount the drive or manually examining /etc/mtab reveals 
that the drive is stll mounted. 
If one is to believe the mount man page, there is/are 1 or 2 bug(s) here.

So, Mark, KDE has a true analogue only if GNOME is similarly broken. 




More information about the CentOS mailing list