PDA

View Full Version : [SOLVED]I can't use my flashdisk as normal user.


fender0107401
March 5th, 2009, 17:18
PC-686.Workstation 7.1-RELEASE-p3 FreeBSD 7.1-RELEASE-p3 #6: Thu Mar 5 22:25:18 CST 2009 fender@PC-686.Workstation:/usr/obj/usr/src/sys/MYKERNEL amd64

as a normal user:

dmesg | grep -i umass
umass0: <Kingston DataTraveler 2.0, class 0/0, rev 2.00/1.10, addr 2> on uhub2
da0 at umass-sim0 bus 0 target 0 lun 0
umass0: at uhub2 port 2 (addr 2) disconnected
(da0:umass-sim0:0:0:0): lost device
(da0:umass-sim0:0:0:0): removing device entry
umass0: detached
umass0: <Kingston DataTraveler 2.0, class 0/0, rev 2.00/1.10, addr 2> on uhub2
da0 at umass-sim0 bus 0 target 0 lun 0
id
uid=1001(fender) gid=1001(fender) groups=1001(fender),0(wheel),5(operator)
ls -l /mnt/
total 2
drwxr-xr-x 2 fender fender 512 Mar 5 21:38 fender
mount_msdosfs /dev/da0s1 /mnt/fender/
mount_msdosfs: /dev/da0s1: : Operation not permitted :(
tail -n2 /etc/devfs.conf
[localrules=5]
add path 'da*' mode 0660 group operator
tail -n1 /etc/sysctl.conf
vfs.usermount=1
mount_msdosfs /dev/da0s1 /mnt/fender/
mount_msdosfs: /dev/da0s1: : Operation not permitted
as root:
id
uid=0(root) gid=0(wheel) groups=0(wheel),5(operator)
mount_msdosfs /dev/da0s1 /mnt/
cd /mnt/ ; ls
7.1-RELEASE-amd64-disc1.iso 7.1-RELEASE-amd64-disc1.md5 :e

Why? I followed this:

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/usb-disks.html

And I use my flashdisk with freebsd on another computer in thi way.

DutchDaemon
March 5th, 2009, 17:28
What happens when you try after /etc/rc.d/devfs restart?

fender0107401
March 5th, 2009, 17:31
/etc/rc.d/devfs restart
/etc/rc.d/devfs: WARNING: devfs_set_ruleset: you must specify a ruleset number
/etc/rc.d/devfs: WARNING: devfs_apply_ruleset: you must specify a ruleset :e

nikobordx
March 5th, 2009, 17:57
have you created a devfs.rules and added to it:

[localrules=5]
add path 'da*' mode 0660 group operator

and adding devfs_system_ruleset="localrules" to your rc.conf file ?

SirDice
March 5th, 2009, 18:03
You need to own the mountpoint.

Edit: scratch that..

Try setting:

sysctl vfs.usermount=1

adamk
March 5th, 2009, 18:42
You haven't actually showed us the permissions for the device... What are they?

EDIT:

Also, if you aren't booting up with the flashdisk already connected, then /etc/devfs.conf doesn't apply. /etc/devd.conf is used to configure devices added to the system after it's running.

Adam

fender0107401
March 6th, 2009, 05:03
have you created a devfs.rules and added to it:

[localrules=5]
add path 'da*' mode 0660 group operator

and adding devfs_system_ruleset="localrules" to your rc.conf file ?
I did, look this:
cat /etc/rc.conf | grep dev
devfs_system_ruleset="localrules"
tail -n2 /etc/devfs.conf
[localrules=5]
add path 'da*' mode 0660 group operator

You need to own the mountpoint.

Edit: scratch that..

Try setting:

sysctl vfs.usermount=1

I do setup this option, look:
sysctl vfs.usermount
vfs.usermount: 1
ls -l /mnt/
total 2
drwxr-xr-x 2 fender fender 512 Mar 5 21:38 fender

You haven't actually showed us the permissions for the device... What are they?

EDIT:

Also, if you aren't booting up with the flashdisk already connected, then /etc/devfs.conf doesn't apply. /etc/devd.conf is used to configure devices added to the system after it's running.

Adam
Do you mean this?
dmesg | grep -i umass
umass0: <Kingston DataTraveler 2.0, class 0/0, rev 2.00/1.10, addr 2> on uhub2
da0 at umass-sim0 bus 0 target 0 lun 0
cd /dev/ ; ls -l | grep da
crw-r----- 1 root operator 0, 95 Mar 6 11:36 da0
crw-r----- 1 root operator 0, 96 Mar 6 11:36 da0s1:(

fender0107401
March 6th, 2009, 05:18
As a root, I can mount the flashdisk, but as a normal user, I can't.

I think the key is:
/etc/rc.d/devfs restart
/etc/rc.d/devfs: WARNING: devfs_set_ruleset: you must specify a ruleset number
/etc/rc.d/devfs: WARNING: devfs_apply_ruleset: you must specify a ruleset
But I don't know how to solve it. :(

adamk
March 6th, 2009, 10:17
So, in other words, you don't have rw access as your normal user. Again: If you aren't booting up with the flashdisk already connected, then /etc/devfs.conf doesn't apply. /etc/devd.conf is used to configure devices added to the system after it's running.

Mel_Flynn
March 6th, 2009, 16:47
So, in other words, you don't have rw access as your normal user. Again: If you aren't booting up with the flashdisk already connected, then /etc/devfs.conf doesn't apply. /etc/devd.conf is used to configure devices added to the system after it's running.

Almost right, but devd.conf is not related to devfs at all. devd provides device events which can be hooked into, while devfs.conf configures /dev/* visibility and permissions for devices at boot time and devfs.rules for dynamic devices.

The warning /etc/rc.d/devfs gives, can be debugged by setting rc_debug="YES" in /etc/rc.conf.

fender0107401
March 7th, 2009, 01:31
I am sorry, It is my fault, I did not notice the difference beteen the devfs.conf and devfs.rules. :e

BSD-Yoda
March 26th, 2009, 15:21
Look Fender:

Conclusion: You have to add da*s* not da* in devfs.rules since da* only gives you access to da1,da2,da(n) not its sub components like da1s1,da2s1,da(n)s(n)

Fixit:

Add following to devfs.rules

add path 'da*s*' 0660 group operator(could also be wheel in your case)

BSD-Yoda.