[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: User unable to umount



On Thu, 2013-05-30 at 09:05 +0200, Erwan David wrote:
> 	Hi have following line in my /etc/fstab
> //server/dir       /mnt/dir         cifs                       defaults,user,noauto,sec=krb5        0       0
> 
> mounting works flawlessly, unsing the ticket obtained through pam_krb5 at login.
> 
> However
> 
> umount /mnt/it leads to :
> 
> umount: only root can unmount //server/dir from /mnt/dir
> 
> There is no point to allowing user to mount but forbiding them yo umount the directory they mounted.
> 
> DO someone have an idea on this problem, or should I report a bug against umount ?

You can use tools to mount and unmount as user, e.g. gvfs, something
that I've got removed from my Linux. What's edited in fstab isn't
mounted by the user. A regular mount and umount can only be done by
root.

I've written workarounds and never felt the need to write something
better, to e.g. mount CDs, since it's easy to become root or to use sudo
and than use regular Linux commands.

[rocketmouse@archlinux ~]$ cat /usr/local/sbin/lmount
#!/bin/sh

# /usr/local/sbin/lmount

case $1 in
      -r|-w) mkdir -p /mnt/$2
             if [ -e "/media/$2" ] ; then :
             else
               ln -s /mnt/$2 /media/$2
             fi
             case $1 in
               -r) mount -rL$2 /mnt/$2;; 
               -w) mount -wL$2 /mnt/$2 -o noatime;;
             esac ;;
         -u) umount "$(blkid -L$2)"
             rm /media/$2; rmdir /mnt/$2;;
  --help|-h) echo
             echo "Usage of /usr/local/sbin/lmount"
             echo
             echo "mount read-only"
             echo "  lmount -r <label>"
             echo "mount read/write noatime"
             echo "  lmount -w <label>"
             echo "unmount"
             echo "  lmount -u <label>"
             echo ;;
esac
exit

[rocketmouse@archlinux ~]$ cat /usr/local/bin/tmount
#!/bin/sh

# /usr/local/bin/tmount

case $1 in
  --help|-h) echo
             echo "Usage of /usr/local/bin/tmount"
             echo
             echo "mount read-only"
             echo "  tmount -r <label>"
             echo "mount read/write noatime"
             echo "  tmount -w <label>"
             echo "unmount"
             echo "  tmount -u <label>"
             echo; exit;;
         -u) gksudo "lmount $*";;
          *) gksudo "lmount $*"; thunar /mnt/$2; gksudo "lmount -u $2";;
esac
exit

Regards,
Ralf


Reply to: