Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Oct 2006 01:21:07 +0930
From:      Malcolm Kay <malcolm.kay@internode.on.net>
To:        freebsd-questions@freebsd.org
Subject:   mount_smbfs/umount for non root user.
Message-ID:  <200610280121.07939.malcolm.kay@internode.on.net>

next in thread | raw e-mail | index | archive | help
Running mount_smbfs as a regular user generates a permission
denial in relation to iconv in the kernel.
This is apparently a well known problem which can be circumvented 
by setting the set-user-id-on-execution bit for mount_smbfs. 
This works for me but leads to the problem that the mount is now 
seen as belonging to root and the regular user gets a denial on 
umount.

Allowing regular users to mount smb shares with mount_smbfs seems
to me fairly benign but to set the  set-user-id-on-execution bit
for umount would be extremely dangerous.

Is there a way around this problem -- this is under FreeBSD 5.4.

Taking a look at the sources for mount_smbfs and the associated 
library, libsmb, I see that conditional compilation for APPLE 
(Darwin?) switches the effective user id when the 
set-user-id-on-execution bit is set with the code executed 
mostly under the identity of the real user and switching to 
privileged mode only for a few brief activities - notably for
installing the iconv table and a few error conditions. Apart from 
this the code looks very similar to (but not quite identical 
with) the FreeBSD code.

I presume (without any real justification) that these differences 
in the APPLE version are intended to circumvent the difficulty I 
am having when running under Darwin.

The question is if I modify the FreeBSD code to perform similar 
switchings of effective user id and recompile am I likely to 
achieve my desired goal? Has anyone else tried this?

Any comments would be welcome.

Malcolm 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200610280121.07939.malcolm.kay>