Via Purifico
2006-Jul-02 20:08 UTC
[Samba] A samba share mounted multiple times cannot be unmounted without root
Hello, recently I've ran into the problem that if a user mounts a share multiple times, then it cannot be mounted, except by root. Here is the relevant fstab line: //sephiroth/E /home/unity/Sephiroth smbfs ro,users,noauto 0 0 A user can mount and unmount the fs fine: unity@oaklandgardens ~ $ cd ~unity/ unity@oaklandgardens ~ $ mount Sephiroth/ Password: unity@oaklandgardens ~ $ mount | grep Seph //sephiroth/E on /home/unity/Sephiroth type smbfs (0) unity@oaklandgardens ~ $ umount Sephiroth/ unity@oaklandgardens ~ $ mount | grep Seph unity@oaklandgardens ~ $ Unless the fs is mounted twice by accident: unity@oaklandgardens ~ $ mount Sephiroth/ Password: unity@oaklandgardens ~ $ mount Sephiroth/ Password: unity@oaklandgardens ~ $ mount | grep Seph //sephiroth/E on /home/unity/Sephiroth type smbfs (0) //sephiroth/E on /home/unity/Sephiroth type smbfs (0) unity@oaklandgardens ~ $ umount Sephiroth/ umount: it seems /home/unity/Sephiroth is mounted multiple times unity@oaklandgardens ~ $ mount | grep Seph //sephiroth/E on /home/unity/Sephiroth type smbfs (0) //sephiroth/E on /home/unity/Sephiroth type smbfs (0) Then, it seems the only way to unmount it in once as as root, and then as a user: unity@oaklandgardens ~ $ su -c "umount Sephiroth/" Password: unity@oaklandgardens ~ $ mount | grep Seph //sephiroth/E on /home/unity/Sephiroth type smbfs (0) unity@oaklandgardens ~ $ umount Sephiroth/ unity@oaklandgardens ~ $ mount | grep Seph unity@oaklandgardens ~ $ If you are wondering, something that is not a samba share cannot be mounted multiple times: unity@oaklandgardens ~ $ mount Mp3/ mount: /dev/hdc1 already mounted or /home/unity/Mp3 busy mount: according to mtab, /dev/hdc1 is already mounted on /home/unity/Mp3 I do not like that a user can mount it, but then if it is mounted twice, the user would not be able to umount it. I do not see why a user should need root privelages to umount something, even if it is marked with the users option. I know from experience that if the Samba server that is serving the share goes offline, then various programs will freeze upon trying to access the directory, and the user will have no way to unmount it. I am wondering if there is a solution to this problem. I am using smbclient Version 3.0.22, and my kernel is 2.6.16-gentoo-r9. If any other information may be relevant, I can supply it. Thanks in advance.