mount_smbfs/umount for non root user.

Malcolm Kay malcolm.kay at
Fri Oct 27 15:51:11 UTC 2006

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 

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.


More information about the freebsd-questions mailing list