[Samba] A samba share mounted multiple times cannot be unmounted without root

Via Purifico union at bluebottle.com
Sun Jul 2 19:59:18 GMT 2006


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 at oaklandgardens ~ $ cd ~unity/
unity at oaklandgardens ~ $ mount Sephiroth/
Password:
unity at oaklandgardens ~ $ mount | grep Seph
//sephiroth/E on /home/unity/Sephiroth type smbfs (0)
unity at oaklandgardens ~ $ umount Sephiroth/
unity at oaklandgardens ~ $ mount | grep Seph
unity at oaklandgardens ~ $ 

Unless the fs is mounted twice by accident:

unity at oaklandgardens ~ $ mount Sephiroth/
Password:
unity at oaklandgardens ~ $ mount Sephiroth/
Password:
unity at oaklandgardens ~ $ mount | grep Seph
//sephiroth/E on /home/unity/Sephiroth type smbfs (0)
//sephiroth/E on /home/unity/Sephiroth type smbfs (0)
unity at oaklandgardens ~ $ umount Sephiroth/
umount: it seems /home/unity/Sephiroth is mounted multiple times
unity at 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 at oaklandgardens ~ $ su -c "umount Sephiroth/"
Password:
unity at oaklandgardens ~ $ mount | grep Seph
//sephiroth/E on /home/unity/Sephiroth type smbfs (0)
unity at oaklandgardens ~ $ umount Sephiroth/
unity at oaklandgardens ~ $ mount | grep Seph
unity at oaklandgardens ~ $ 

If you are wondering, something that is not a samba share cannot be mounted 
multiple times:

unity at 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.


More information about the samba mailing list