Re: mount_msdosfs -L ... [odd behaviour ?]

2010-10-30 Thread Lowell Gilbert
dan gl...@live.com writes:

 On 10/29/10 01:00, Chuck Swiger wrote:
 Hi, Dan--

 On Oct 28, 2010, at 3:45 PM, dan wrote:
 'mount_msdosfs -L en_US.UTF-8 /dev/da0 local/mnt/'

 executed by a non root-user prints out the following

 mount_msdosfs: msdosfs_iconv: Operation not permitted

 and then stops with error 71 on console.

 Later, the same command, executed by the same user, completes correctly if 
 some time before the root user has succesfully issued it and unmounted the 
 device.

 Any clues ? Things I am probably missing ? Does Anyone else notice this 
 (odd) behaviour (if it is odd) ?

 It's probably coming from /usr/src/sbin/mount_msdosfs/mount_msdosfs.c:

if (set_charset(iov,iovlen, cs_local, cs_dos) == -1)
  err(EX_OSERR, msdosfs_iconv);

 ...since set_charset() tries to load the msdosfs_iconv  libiconv kernel 
 modules:

  if (modfind(msdosfs_iconv)  0)
  if (kldload(msdosfs_iconv)  0 || modfind(msdosfs_iconv)  0) {
  warnx(cannot find or load \msdosfs_iconv\ kernel module);
  return (-1);
  }

 kldload() fails with EPERM if you are not root:

   [EPERM]You do not have access to read the file or link it
  with the kernel.  You should be the root user to be
  able to use the kld system calls.

 Once root has loaded these modules, you can invoke mount_msdosfs as a normal 
 user because they are already available.  You can put kldload 
 msdosfs_iconv into /etc/rc.local, or maybe tweak /boot/loader.conf to load 
 these at boot if you prefer.

 Regards,
 Hello :-)

 Thank you for your research and prompt response. The module was
 available. I tried both: kldload in command line and adding it in
 loader.conf.

 Note. In case the module has not been been loaded,as a user, here, one
 gets 2 messages
 mount_msdosfs: cannot find or load msdosfs_iconv kernel module
 AND
 mount_msdosfs: msdosfs_iconv: Operation not permitted

 I wonder what Operation is not permitted as a user and what rights the
 user needs.

The missing operation is the loading of kernel modules, and there is no
way to do it without root privileges. Just do it at boot time (from
loader.conf), and you'll be fine.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: mount_msdosfs -L ... [odd behaviour ?]

2010-10-30 Thread dan

On 10/29/2010 20:05, David DEMELIER wrote:

2010/10/29 Adam Vande Moreamvandem...@gmail.com:

On Fri, Oct 29, 2010 at 7:53 AM, dangl...@live.com  wrote:


On 10/29/10 13:22, Adam Vande More wrote:


On Fri, Oct 29, 2010 at 6:13 AM, dangl...@live.comwrote:

  Thank you for your research and prompt response. The module was

available.
I tried both: kldload in command line and adding it in loader.conf.

Note. In case the module has not been been loaded,as a user, here, one
gets
2 messages
mount_msdosfs: cannot find or load msdosfs_iconv kernel module
AND

mount_msdosfs: msdosfs_iconv: Operation not permitted

I wonder what Operation is not permitted as a user and what rights the
user
needs.




sysctl vfs.usermount=1

Although it doesn't seem correct that you can mount that FS if it's
already
been mounted previously by root when that sysctl is at 0.



Hello

vfs.usermount is already set. In fact, I can readily mount the filesystem
if I do not specify -L 

I did mount and then soon unmount the filesystem as root with -L 



I see now.  The loading of the kernel module is not permitted as I think the
mount command attempts to load it if necessary.  I'm not aware of any method
of granting access to user which would allow them to load/unload kernel
modules.  Only root level privs can do that.


--
Adam Vande More
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org



I have the same trouble, I usually mount device by user with
vfs.usermount=1 but for libiconv I need root...

--
Demelier David
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org



Hello again,

I took a deeper look at the code. And later I found some work on the 
topic. Standard users receive error when mounting the file system -even 
if they have rights to mount it- because :


character set conversion tables need to be loaded into kernel and  
that's not allowed to plain users, because charset tables are large 
enough to initiate a denial of service by filling kernel memory with 
many tables


As I lernt while searching, one solution to the problem (if one wants to 
avoid mounting as root) is to preload some conversion tables when the 
system starts up. Some software has been developed to reach this goal: 
kiconvtool, that one can find in the ports tree [1] and that has been 
developed by Dmitry Marakasov [2] (thanks !!!).


By the way, even if this software solved a big part of the problem and 
gave me a huge hand, to let it completely work I needed to slightly 
modify it because something was missing.


Everything is explained in the following bug report :

http://www.freebsd.org/cgi/query-pr.cgi?pr=151833

Thanks, Gentlemen, for the pointers ;)

d

[1] http://www.freebsd.org/cgi/cvsweb.cgi/ports/sysutils/kiconvtool/
[2] http://wiki.freebsd.org/DmitryMarakasov/kiconvtool




___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: mount_msdosfs -L ... [odd behaviour ?]

2010-10-29 Thread dan

On 10/29/10 01:00, Chuck Swiger wrote:

Hi, Dan--

On Oct 28, 2010, at 3:45 PM, dan wrote:

'mount_msdosfs -L en_US.UTF-8 /dev/da0 local/mnt/'

executed by a non root-user prints out the following

mount_msdosfs: msdosfs_iconv: Operation not permitted

and then stops with error 71 on console.

Later, the same command, executed by the same user, completes correctly if some 
time before the root user has succesfully issued it and unmounted the device.

Any clues ? Things I am probably missing ? Does Anyone else notice this (odd) 
behaviour (if it is odd) ?


It's probably coming from /usr/src/sbin/mount_msdosfs/mount_msdosfs.c:

   if (set_charset(iov,iovlen, cs_local, cs_dos) == -1)
 err(EX_OSERR, msdosfs_iconv);

...since set_charset() tries to load the msdosfs_iconv  libiconv kernel 
modules:

 if (modfind(msdosfs_iconv)  0)
 if (kldload(msdosfs_iconv)  0 || modfind(msdosfs_iconv)  0) {
 warnx(cannot find or load \msdosfs_iconv\ kernel module);
 return (-1);
 }

kldload() fails with EPERM if you are not root:

  [EPERM]You do not have access to read the file or link it
 with the kernel.  You should be the root user to be
 able to use the kld system calls.

Once root has loaded these modules, you can invoke mount_msdosfs as a normal user because 
they are already available.  You can put kldload msdosfs_iconv into 
/etc/rc.local, or maybe tweak /boot/loader.conf to load these at boot if you prefer.

Regards,

Hello :-)

Thank you for your research and prompt response. The module was 
available. I tried both: kldload in command line and adding it in 
loader.conf.


Note. In case the module has not been been loaded,as a user, here, one 
gets 2 messages

mount_msdosfs: cannot find or load msdosfs_iconv kernel module
AND
mount_msdosfs: msdosfs_iconv: Operation not permitted

I wonder what Operation is not permitted as a user and what rights the 
user needs.


d
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: mount_msdosfs -L ... [odd behaviour ?]

2010-10-29 Thread Adam Vande More
On Fri, Oct 29, 2010 at 6:13 AM, dan gl...@live.com wrote:

 Thank you for your research and prompt response. The module was available.
 I tried both: kldload in command line and adding it in loader.conf.

 Note. In case the module has not been been loaded,as a user, here, one gets
 2 messages
 mount_msdosfs: cannot find or load msdosfs_iconv kernel module
 AND

 mount_msdosfs: msdosfs_iconv: Operation not permitted

 I wonder what Operation is not permitted as a user and what rights the user
 needs.


sysctl vfs.usermount=1

Although it doesn't seem correct that you can mount that FS if it's already
been mounted previously by root when that sysctl is at 0.

-- 
Adam Vande More
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: mount_msdosfs -L ... [odd behaviour ?]

2010-10-29 Thread dan

On 10/29/10 13:22, Adam Vande More wrote:

On Fri, Oct 29, 2010 at 6:13 AM, dangl...@live.com  wrote:


Thank you for your research and prompt response. The module was available.
I tried both: kldload in command line and adding it in loader.conf.

Note. In case the module has not been been loaded,as a user, here, one gets
2 messages
mount_msdosfs: cannot find or load msdosfs_iconv kernel module
AND

mount_msdosfs: msdosfs_iconv: Operation not permitted

I wonder what Operation is not permitted as a user and what rights the user
needs.



sysctl vfs.usermount=1

Although it doesn't seem correct that you can mount that FS if it's already
been mounted previously by root when that sysctl is at 0.



Hello

vfs.usermount is already set. In fact, I can readily mount the 
filesystem if I do not specify -L 


I did mount and then soon unmount the filesystem as root with -L 

d
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: mount_msdosfs -L ... [odd behaviour ?]

2010-10-29 Thread Adam Vande More
On Fri, Oct 29, 2010 at 7:53 AM, dan gl...@live.com wrote:

 On 10/29/10 13:22, Adam Vande More wrote:

 On Fri, Oct 29, 2010 at 6:13 AM, dangl...@live.com  wrote:

  Thank you for your research and prompt response. The module was
 available.
 I tried both: kldload in command line and adding it in loader.conf.

 Note. In case the module has not been been loaded,as a user, here, one
 gets
 2 messages
 mount_msdosfs: cannot find or load msdosfs_iconv kernel module
 AND

 mount_msdosfs: msdosfs_iconv: Operation not permitted

 I wonder what Operation is not permitted as a user and what rights the
 user
 needs.



 sysctl vfs.usermount=1

 Although it doesn't seem correct that you can mount that FS if it's
 already
 been mounted previously by root when that sysctl is at 0.


 Hello

 vfs.usermount is already set. In fact, I can readily mount the filesystem
 if I do not specify -L 

 I did mount and then soon unmount the filesystem as root with -L 


I see now.  The loading of the kernel module is not permitted as I think the
mount command attempts to load it if necessary.  I'm not aware of any method
of granting access to user which would allow them to load/unload kernel
modules.  Only root level privs can do that.


-- 
Adam Vande More
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: mount_msdosfs -L ... [odd behaviour ?]

2010-10-29 Thread David DEMELIER
2010/10/29 Adam Vande More amvandem...@gmail.com:
 On Fri, Oct 29, 2010 at 7:53 AM, dan gl...@live.com wrote:

 On 10/29/10 13:22, Adam Vande More wrote:

 On Fri, Oct 29, 2010 at 6:13 AM, dangl...@live.com  wrote:

  Thank you for your research and prompt response. The module was
 available.
 I tried both: kldload in command line and adding it in loader.conf.

 Note. In case the module has not been been loaded,as a user, here, one
 gets
 2 messages
 mount_msdosfs: cannot find or load msdosfs_iconv kernel module
 AND

 mount_msdosfs: msdosfs_iconv: Operation not permitted

 I wonder what Operation is not permitted as a user and what rights the
 user
 needs.



 sysctl vfs.usermount=1

 Although it doesn't seem correct that you can mount that FS if it's
 already
 been mounted previously by root when that sysctl is at 0.


 Hello

 vfs.usermount is already set. In fact, I can readily mount the filesystem
 if I do not specify -L 

 I did mount and then soon unmount the filesystem as root with -L 


 I see now.  The loading of the kernel module is not permitted as I think the
 mount command attempts to load it if necessary.  I'm not aware of any method
 of granting access to user which would allow them to load/unload kernel
 modules.  Only root level privs can do that.


 --
 Adam Vande More
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


I have the same trouble, I usually mount device by user with
vfs.usermount=1 but for libiconv I need root...

--
Demelier David
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


mount_msdosfs -L ... [odd behaviour ?]

2010-10-28 Thread dan

Hello :-)

'mount_msdosfs -L en_US.UTF-8 /dev/da0 local/mnt/'

executed by a non root-user prints out the following

mount_msdosfs: msdosfs_iconv: Operation not permitted

and then stops with error 71 on console.

Later, the same command, executed by the same user, completes correctly 
if some time before the root user has succesfully issued it and 
unmounted the device.


Any clues ? Things I am probably missing ? Does Anyone else notice this 
(odd) behaviour (if it is odd) ?


Thank you

d

* FreeBSD 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Mon Jul 19 02:55:53 UTC 
2010 /usr/obj/usr/src/sys/GENERIC  i386


* http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/109024 , similar 
problem but dates 2007 / 2009 ... :-O

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


mount_msdosfs -L ... [odd behaviour ?]

2010-10-28 Thread dan

Hello :-)

'mount_msdosfs -L en_US.UTF-8 /dev/da0 local/mnt/'

executed by a non root-user prints out the following

mount_msdosfs: msdosfs_iconv: Operation not permitted

and then stops with error 71 on console.

Later, the same command, executed by the same user, completes correctly 
if some time before the root user has succesfully issued it and 
unmounted the device.


Any clues ? Things I am probably missing ? Does Anyone else notice this 
(odd) behaviour (if it is odd) ?


Thank you

d

* FreeBSD 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Mon Jul 19 02:55:53 UTC 
2010 /usr/obj/usr/src/sys/GENERIC  i386


* http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/109024 , similar 
problem but dates 2007 / 2009 ... :-O

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: mount_msdosfs -L ... [odd behaviour ?]

2010-10-28 Thread Chuck Swiger
Hi, Dan--

On Oct 28, 2010, at 3:45 PM, dan wrote:
 'mount_msdosfs -L en_US.UTF-8 /dev/da0 local/mnt/'
 
 executed by a non root-user prints out the following
 
 mount_msdosfs: msdosfs_iconv: Operation not permitted
 
 and then stops with error 71 on console.
 
 Later, the same command, executed by the same user, completes correctly if 
 some time before the root user has succesfully issued it and unmounted the 
 device.
 
 Any clues ? Things I am probably missing ? Does Anyone else notice this (odd) 
 behaviour (if it is odd) ?

It's probably coming from /usr/src/sbin/mount_msdosfs/mount_msdosfs.c:

  if (set_charset(iov, iovlen, cs_local, cs_dos) == -1)
err(EX_OSERR, msdosfs_iconv);

...since set_charset() tries to load the msdosfs_iconv  libiconv kernel 
modules:

if (modfind(msdosfs_iconv)  0)
if (kldload(msdosfs_iconv)  0 || modfind(msdosfs_iconv)  0) {
warnx(cannot find or load \msdosfs_iconv\ kernel module);
return (-1);
}

kldload() fails with EPERM if you are not root:

 [EPERM]You do not have access to read the file or link it
with the kernel.  You should be the root user to be
able to use the kld system calls.

Once root has loaded these modules, you can invoke mount_msdosfs as a normal 
user because they are already available.  You can put kldload msdosfs_iconv 
into /etc/rc.local, or maybe tweak /boot/loader.conf to load these at boot if 
you prefer.

Regards,
-- 
-Chuck

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org