Using a scanner (USB) as user and not as root

2010-04-28 Thread Marco Beishuizen

Hi,

I have a flatbed scanner (a HP ScanJet 4400c) that works with SANE (and 
Xsane), but only as root and I want to access it as user. After some 
googling and reading the handbook I copied the default file 
/etc/defaults/devfs.rules to /etc/ and added the lines:


[system=5]
add path 'ugen*' mode 0664 group usb
add path 'usb/*' mode 0666 group usb

and also made the group usb with root and the user in /etc/group.
I also added devfs_system_ruleset="system" to /etc/rc.conf.

After a reboot, USB and the scanner are still only accessible as root and 
not as user. What am I doing wrong?


Thanks in advance.

Marco
--
Alan Turing thought about criteria to settle the question of whether
machines can think, a question of which we now know that it is about
as relevant as the question of whether submarines can swim.
-- Edsger W. Dijkstra
___
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: Using a scanner (USB) as user and not as root

2010-04-28 Thread Roland Smith
On Wed, Apr 28, 2010 at 07:50:04PM +0200, Marco Beishuizen wrote:
> Hi,
> 
> I have a flatbed scanner (a HP ScanJet 4400c) that works with SANE (and 
> Xsane), but only as root and I want to access it as user. After some 
> googling and reading the handbook I copied the default file 
> /etc/defaults/devfs.rules to /etc/ and added the lines:
> 
> [system=5]
> add path 'ugen*' mode 0664 group usb
> add path 'usb/*' mode 0666 group usb
> 
> and also made the group usb with root and the user in /etc/group.
> I also added devfs_system_ruleset="system" to /etc/rc.conf.
> 
> After a reboot, USB and the scanner are still only accessible as root and 
> not as user. What am I doing wrong?

Are the permissions correct? Check with 'ls -l /dev/usb/ /dev/ugen*'.
Is your user-id in the usb group? Check by running 'id' as the normal user.

If all that is in order, remove all lines except the three above from
/etc/devfs.rules, and try again.

-- 
R.F.Smith   http://www.xs4all.nl/~rsmith/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)


pgpv3hIRSjxM7.pgp
Description: PGP signature


Re: Using a scanner (USB) as user and not as root

2010-04-28 Thread Marco Beishuizen

On Wed, 28 Apr 2010, Roland Smith wrote:


Are the permissions correct? Check with 'ls -l /dev/usb/ /dev/ugen*'.
Is your user-id in the usb group? Check by running 'id' as the normal user.

If all that is in order, remove all lines except the three above from
/etc/devfs.rules, and try again.


Running id as user looks ok:

uid=1001(marco) gid=0(wheel) groups=0(wheel),5(operator),1001(usb)

But the permissions are not:

ls -l /dev/usb/ /dev/ugen*
lrw-rw-r--  1 root  usb  9 Apr 28 19:05 /dev/ugen0.1 -> usb/0.1.0
lrw-rw-r--  1 root  usb  9 Apr 28 19:05 /dev/ugen1.1 -> usb/1.1.0
lrw-rw-r--  1 root  usb  9 Apr 28 21:05 /dev/ugen1.2 -> usb/1.2.0
lrw-rw-r--  1 root  usb  9 Apr 28 21:05 /dev/ugen1.3 -> usb/1.3.0
lrw-rw-r--  1 root  usb  9 Apr 28 19:05 /dev/ugen2.1 -> usb/2.1.0

/dev/usb/:
total 0
crw---  1 root  operator0,  87 Apr 28 19:05 0.1.0
crw---  1 root  operator0,  93 Apr 28 19:05 0.1.1
crw---  1 root  operator0,  89 Apr 28 19:05 1.1.0
crw---  1 root  operator0,  94 Apr 28 19:05 1.1.1
crw---  1 root  operator0, 104 Apr 28 21:05 1.2.0
crw---  1 root  operator0, 105 Apr 28 21:05 1.2.1
crw---  1 root  operator0, 117 Apr 28 21:05 1.3.0
crw---  1 root  operator0, 119 Apr 28 21:05 1.3.1
crw---  1 root  operator0,  91 Apr 28 19:05 2.1.0
crw---  1 root  operator0,  95 Apr 28 19:05 2.1.1

Regards,
Marco
--
Be braver -- you can't cross a chasm in two small jumps.
___
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: Using a scanner (USB) as user and not as root

2010-04-28 Thread Warren Block

On Wed, 28 Apr 2010, Marco Beishuizen wrote:


On Wed, 28 Apr 2010, Roland Smith wrote:


Are the permissions correct? Check with 'ls -l /dev/usb/ /dev/ugen*'.
Is your user-id in the usb group? Check by running 'id' as the normal user.

If all that is in order, remove all lines except the three above from
/etc/devfs.rules, and try again.


Running id as user looks ok:

uid=1001(marco) gid=0(wheel) groups=0(wheel),5(operator),1001(usb)

But the permissions are not:

ls -l /dev/usb/ /dev/ugen*
lrw-rw-r--  1 root  usb  9 Apr 28 19:05 /dev/ugen0.1 -> usb/0.1.0
lrw-rw-r--  1 root  usb  9 Apr 28 19:05 /dev/ugen1.1 -> usb/1.1.0
lrw-rw-r--  1 root  usb  9 Apr 28 21:05 /dev/ugen1.2 -> usb/1.2.0
lrw-rw-r--  1 root  usb  9 Apr 28 21:05 /dev/ugen1.3 -> usb/1.3.0
lrw-rw-r--  1 root  usb  9 Apr 28 19:05 /dev/ugen2.1 -> usb/2.1.0

/dev/usb/:
total 0
crw---  1 root  operator0,  87 Apr 28 19:05 0.1.0
crw---  1 root  operator0,  93 Apr 28 19:05 0.1.1
crw---  1 root  operator0,  89 Apr 28 19:05 1.1.0
crw---  1 root  operator0,  94 Apr 28 19:05 1.1.1
crw---  1 root  operator0, 104 Apr 28 21:05 1.2.0
crw---  1 root  operator0, 105 Apr 28 21:05 1.2.1
crw---  1 root  operator0, 117 Apr 28 21:05 1.3.0
crw---  1 root  operator0, 119 Apr 28 21:05 1.3.1
crw---  1 root  operator0,  91 Apr 28 19:05 2.1.0
crw---  1 root  operator0,  95 Apr 28 19:05 2.1.1


You can use devd.conf for this:

attach 100 {
device-name "ugen[0-9].[0-9]";
match "vendor" "0x04b8";
match "product" "0x010a";
action "usb_devaddr=`echo $device-name | sed 's#^ugen##'` && \
chown root:saned /dev/usb/${usb_devaddr}.* && \
chmod 0660 /dev/usb/${usb_devaddr}.*

Copied from a post on -current or similar; apologies to the author, who 
I've forgotten.  I thought this was in the default devd.conf as an 
example, but it appears not.


devfs.rules don't apply to devices that are created dynamically after 
boot-up.  Or I guess they might be if you reload the ruleset with 
applyset after the device is created, but devd is a lot more capable.


-Warren Block * Rapid City, South Dakota USA
___
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: Using a scanner (USB) as user and not as root

2010-04-28 Thread Roland Smith
On Wed, Apr 28, 2010 at 09:00:40PM +0200, Marco Beishuizen wrote:
> On Wed, 28 Apr 2010, Roland Smith wrote:
> 
> > Are the permissions correct? Check with 'ls -l /dev/usb/ /dev/ugen*'.
> > Is your user-id in the usb group? Check by running 'id' as the normal user.
> >
> > If all that is in order, remove all lines except the three above from
> > /etc/devfs.rules, and try again.
> 
> Running id as user looks ok:
> 
> uid=1001(marco) gid=0(wheel) groups=0(wheel),5(operator),1001(usb)
> 
> But the permissions are not:
> 
> ls -l /dev/usb/ /dev/ugen*
> lrw-rw-r--  1 root  usb  9 Apr 28 19:05 /dev/ugen0.1 -> usb/0.1.0
> lrw-rw-r--  1 root  usb  9 Apr 28 19:05 /dev/ugen1.1 -> usb/1.1.0
> lrw-rw-r--  1 root  usb  9 Apr 28 21:05 /dev/ugen1.2 -> usb/1.2.0
> lrw-rw-r--  1 root  usb  9 Apr 28 21:05 /dev/ugen1.3 -> usb/1.3.0
> lrw-rw-r--  1 root  usb  9 Apr 28 19:05 /dev/ugen2.1 -> usb/2.1.0
> 
> /dev/usb/:
> total 0
> crw---  1 root  operator0,  87 Apr 28 19:05 0.1.0
> crw---  1 root  operator0,  93 Apr 28 19:05 0.1.1
> crw---  1 root  operator0,  89 Apr 28 19:05 1.1.0
> crw---  1 root  operator0,  94 Apr 28 19:05 1.1.1
> crw---  1 root  operator0, 104 Apr 28 21:05 1.2.0
> crw---  1 root  operator0, 105 Apr 28 21:05 1.2.1
> crw---  1 root  operator0, 117 Apr 28 21:05 1.3.0
> crw---  1 root  operator0, 119 Apr 28 21:05 1.3.1
> crw---  1 root  operator0,  91 Apr 28 19:05 2.1.0
> crw---  1 root  operator0,  95 Apr 28 19:05 2.1.1

In that case I think that there is something wrong with your rules. Running
'devfs rule show' should show the current active ruleset.

Make sure that there is a newline at the end of your 'usb/*' rule! Otherwise
the shell script that parses /etc/devfs.rules will not spot the last line.

Roland
-- 
R.F.Smith   http://www.xs4all.nl/~rsmith/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)


pgpn7ALzF82Vj.pgp
Description: PGP signature


Re: Using a scanner (USB) as user and not as root

2010-04-29 Thread Marco Beishuizen

On Wed, 28 Apr 2010, Warren Block wrote:


You can use devd.conf for this:

attach 100 {
   device-name "ugen[0-9].[0-9]";
   match "vendor" "0x04b8";
   match "product" "0x010a";
   action "usb_devaddr=`echo $device-name | sed 's#^ugen##'` && \
   chown root:saned /dev/usb/${usb_devaddr}.* && \
   chmod 0660 /dev/usb/${usb_devaddr}.*

Copied from a post on -current or similar; apologies to the author, who I've 
forgotten.  I thought this was in the default devd.conf as an example, but it 
appears not.


devfs.rules don't apply to devices that are created dynamically after 
boot-up.  Or I guess they might be if you reload the ruleset with applyset 
after the device is created, but devd is a lot more capable.


Unfortunately this didn't help either (I replaced the vendor and product 
with the correct digits for my scanner, and the chown with the user name). 
The usb devices are still owned by root and not accessible as user.


Marco
--
You have the capacity to learn from mistakes.
You'll learn a lot today.
___
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: Using a scanner (USB) as user and not as root

2010-04-29 Thread David DEMELIER
2010/4/28 Warren Block :
> On Wed, 28 Apr 2010, Marco Beishuizen wrote:
>
>> On Wed, 28 Apr 2010, Roland Smith wrote:
>>
>>> Are the permissions correct? Check with 'ls -l /dev/usb/ /dev/ugen*'.
>>> Is your user-id in the usb group? Check by running 'id' as the normal
>>> user.
>>>
>>> If all that is in order, remove all lines except the three above from
>>> /etc/devfs.rules, and try again.
>>
>> Running id as user looks ok:
>>
>> uid=1001(marco) gid=0(wheel) groups=0(wheel),5(operator),1001(usb)
>>
>> But the permissions are not:
>>
>> ls -l /dev/usb/ /dev/ugen*
>> lrw-rw-r--  1 root  usb  9 Apr 28 19:05 /dev/ugen0.1 -> usb/0.1.0
>> lrw-rw-r--  1 root  usb  9 Apr 28 19:05 /dev/ugen1.1 -> usb/1.1.0
>> lrw-rw-r--  1 root  usb  9 Apr 28 21:05 /dev/ugen1.2 -> usb/1.2.0
>> lrw-rw-r--  1 root  usb  9 Apr 28 21:05 /dev/ugen1.3 -> usb/1.3.0
>> lrw-rw-r--  1 root  usb  9 Apr 28 19:05 /dev/ugen2.1 -> usb/2.1.0
>>
>> /dev/usb/:
>> total 0
>> crw---  1 root  operator    0,  87 Apr 28 19:05 0.1.0
>> crw---  1 root  operator    0,  93 Apr 28 19:05 0.1.1
>> crw---  1 root  operator    0,  89 Apr 28 19:05 1.1.0
>> crw---  1 root  operator    0,  94 Apr 28 19:05 1.1.1
>> crw---  1 root  operator    0, 104 Apr 28 21:05 1.2.0
>> crw---  1 root  operator    0, 105 Apr 28 21:05 1.2.1
>> crw---  1 root  operator    0, 117 Apr 28 21:05 1.3.0
>> crw---  1 root  operator    0, 119 Apr 28 21:05 1.3.1
>> crw---  1 root  operator    0,  91 Apr 28 19:05 2.1.0
>> crw---  1 root  operator    0,  95 Apr 28 19:05 2.1.1
>
> You can use devd.conf for this:
>
> attach 100 {
>        device-name "ugen[0-9].[0-9]";
>        match "vendor" "0x04b8";
>        match "product" "0x010a";
>        action "usb_devaddr=`echo $device-name | sed 's#^ugen##'` && \
>                chown root:saned /dev/usb/${usb_devaddr}.* && \
>                chmod 0660 /dev/usb/${usb_devaddr}.*
>
> Copied from a post on -current or similar; apologies to the author, who I've
> forgotten.  I thought this was in the default devd.conf as an example, but
> it appears not.
>
> devfs.rules don't apply to devices that are created dynamically after
> boot-up.  Or I guess they might be if you reload the ruleset with applyset
> after the device is created, but devd is a lot more capable.
>
from devfs.rules(5) :

NAME
 devfs.rules — devfs configuration information

DESCRIPTION
 The devfs.rules file provides an easy way to create and apply devfs(8)
 rules, *even for devices that are not available at boot.*

But devfs.rules is specially made for device not available at boot
such as usb keys.

> -Warren Block * Rapid City, South Dakota USA
> ___
> 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"
>



-- 
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"


Re: Using a scanner (USB) as user and not as root

2010-04-29 Thread Warren Block

On Thu, 29 Apr 2010, Marco Beishuizen wrote:


On Wed, 28 Apr 2010, Warren Block wrote:


You can use devd.conf for this:

attach 100 {
   device-name "ugen[0-9].[0-9]";
   match "vendor" "0x04b8";
   match "product" "0x010a";
   action "usb_devaddr=`echo $device-name | sed 's#^ugen##'` && \
   chown root:saned /dev/usb/${usb_devaddr}.* && \
   chmod 0660 /dev/usb/${usb_devaddr}.*

Copied from a post on -current or similar; apologies to the author, who 
I've forgotten.  I thought this was in the default devd.conf as an example, 
but it appears not.


devfs.rules don't apply to devices that are created dynamically after 
boot-up.  Or I guess they might be if you reload the ruleset with applyset 
after the device is created, but devd is a lot more capable.


Unfortunately this didn't help either (I replaced the vendor and product with 
the correct digits for my scanner, and the chown with the user name). The usb 
devices are still owned by root and not accessible as user.


For the sake of completeness: devd has to be restarted after changes to 
devd.conf, and the code above is only executed when the scanner is 
detected (USB cable plugged in or scanner powered on).


-Warren Block * Rapid City, South Dakota USA
___
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: Using a scanner (USB) as user and not as root

2010-04-29 Thread Marco Beishuizen

On Thu, 29 Apr 2010, Warren Block wrote:

For the sake of completeness: devd has to be restarted after changes to 
devd.conf, and the code above is only executed when the scanner is detected 
(USB cable plugged in or scanner powered on).


I rebooted and plugged in the scanner but no changes.

Marco

--
I have more hit points that you can possible imagine.
___
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: Using a scanner (USB) as user and not as root

2010-04-29 Thread Warren Block

On Thu, 29 Apr 2010, David DEMELIER wrote:

2010/4/28 Warren Block :

devfs.rules don't apply to devices that are created dynamically after
boot-up.  Or I guess they might be if you reload the ruleset with applyset
after the device is created, but devd is a lot more capable.


from devfs.rules(5) :

NAME
devfs.rules ? devfs configuration information

DESCRIPTION
The devfs.rules file provides an easy way to create and apply devfs(8)
rules, *even for devices that are not available at boot.*

But devfs.rules is specially made for device not available at boot
such as usb keys.


Apparently I was thinking of devfs.conf.  But I have had difficulties 
with devfs.rules and USB devices.


-Warren Block * Rapid City, South Dakota USA___
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: Using a scanner (USB) as user and not as root

2010-04-29 Thread Warren Block

On Thu, 29 Apr 2010, Marco Beishuizen wrote:


On Thu, 29 Apr 2010, Warren Block wrote:

For the sake of completeness: devd has to be restarted after changes to 
devd.conf, and the code above is only executed when the scanner is detected 
(USB cable plugged in or scanner powered on).


I rebooted and plugged in the scanner but no changes.


One other difference I found in my /etc/devfs.rules:

add path 'ugen*' mode 0660 group operator
add path 'usb/*' mode 0770 group operator

-Warren Block * Rapid City, South Dakota USA
___
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: Using a scanner (USB) as user and not as root

2010-04-29 Thread Warren Block

On Thu, 29 Apr 2010, Warren Block wrote:


On Wed, 28 Apr 2010, Warren Block wrote:

You can use devd.conf for this:

attach 100 {
   device-name "ugen[0-9].[0-9]";
   match "vendor" "0x04b8";
   match "product" "0x010a";
   action "usb_devaddr=`echo $device-name | sed 's#^ugen##'` && \
   chown root:saned /dev/usb/${usb_devaddr}.* && \
   chmod 0660 /dev/usb/${usb_devaddr}.*


One more problem: there should be a quote at the end of the last line.

attach 100 {
device-name "ugen[0-9].[0-9]";
match "vendor" "0x04b8";
match "product" "0x010a";
action "usb_devaddr=`echo $device-name | sed 's#^ugen##'` && \
chown root:saned /dev/usb/${usb_devaddr}.* && \
chmod 0660 /dev/usb/${usb_devaddr}.*"

(My fault, my script does other stuff after that.)

-Warren Block * Rapid City, South Dakota USA
___
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: Using a scanner (USB) as user and not as root

2010-04-29 Thread Marco Beishuizen

On Thu, 29 Apr 2010, Warren Block wrote:


One more problem: there should be a quote at the end of the last line.

attach 100 {
device-name "ugen[0-9].[0-9]";
match "vendor" "0x04b8";
match "product" "0x010a";
action "usb_devaddr=`echo $device-name | sed 's#^ugen##'` && \
chown root:saned /dev/usb/${usb_devaddr}.* && \
chmod 0660 /dev/usb/${usb_devaddr}.*"


Shouldn't there be a ; at the end of the action line also? Because every 
line above ends with it too. I also ended the total attach 100 statement 
with }; because that seems the case in the rest of devd.conf.


To see if these changes work I'll have to reboot later because I'm 
updating my ports, and this can take a while...


Marco

--
I was in this prematurely air conditioned supermarket and there were all
these aisles and there were these bathing caps you could buy that had these
kind of Fourth of July plumes on them that were red and yellow and blue and
I wasn't tempted to buy one but I was reminded of the fact that I had been
avoiding the beach.
-- Lucinda Childs "Einstein On The Beach"
___
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: Using a scanner (USB) as user and not as root

2010-04-29 Thread Roland Smith
On Thu, Apr 29, 2010 at 03:09:02PM -0600, Warren Block wrote:
> On Thu, 29 Apr 2010, Marco Beishuizen wrote:
> 
> > On Thu, 29 Apr 2010, Warren Block wrote:
> >
> >> For the sake of completeness: devd has to be restarted after changes to 
> >> devd.conf, and the code above is only executed when the scanner is 
> >> detected 
> >> (USB cable plugged in or scanner powered on).
> >
> > I rebooted and plugged in the scanner but no changes.
> 
> One other difference I found in my /etc/devfs.rules:
> 
> add path 'ugen*' mode 0660 group operator
> add path 'usb/*' mode 0770 group operator

Mode 0660 should be sufficient. Just make sure there is a newline at the end
of the last rule! Otherwise the shell script that processes them will not see
them. The command 'devfs rule show' will tell you which rules have actually
been created.

Roland
-- 
R.F.Smith   http://www.xs4all.nl/~rsmith/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)


pgp5KkfDzykSQ.pgp
Description: PGP signature


Re: Using a scanner (USB) as user and not as root

2010-04-29 Thread Warren Block

On Thu, 29 Apr 2010, Marco Beishuizen wrote:


On Thu, 29 Apr 2010, Warren Block wrote:


One more problem: there should be a quote at the end of the last line.

attach 100 {
device-name "ugen[0-9].[0-9]";
match "vendor" "0x04b8";
match "product" "0x010a";
action "usb_devaddr=`echo $device-name | sed 's#^ugen##'` && \
chown root:saned /dev/usb/${usb_devaddr}.* && \
chmod 0660 /dev/usb/${usb_devaddr}.*"


Shouldn't there be a ; at the end of the action line also? Because every line 
above ends with it too. I also ended the total attach 100 statement with }; 
because that seems the case in the rest of devd.conf.


Yes, sorry about that.  Next time I'm going to post the whole section 
instead of trying to edit it down.


To see if these changes work I'll have to reboot later because I'm updating 
my ports, and this can take a while...


There's '/etc/rc.d/devd restart', but it's probably not something to 
experiment with during updates.


-Warren Block * Rapid City, South Dakota USA
___
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: Using a scanner (USB) as user and not as root

2010-04-29 Thread Warren Block

On Fri, 30 Apr 2010, Roland Smith wrote:

On Thu, Apr 29, 2010 at 03:09:02PM -0600, Warren Block wrote:


One other difference I found in my /etc/devfs.rules:

add path 'ugen*' mode 0660 group operator
add path 'usb/*' mode 0770 group operator


Mode 0660 should be sufficient.


Just tried, and you're right, it is.

Just make sure there is a newline at the end of the last rule! 
Otherwise the shell script that processes them will not see them.


Seems like it ought to append a newline to devfs.rules before processing 
to avoid that type of surprise.


-Warren Block * Rapid City, South Dakota USA
___
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: Using a scanner (USB) as user and not as root

2010-04-30 Thread Marco Beishuizen

On Fri, 30 Apr 2010, Warren Block wrote:


On Thu, 29 Apr 2010, Marco Beishuizen wrote:


On Thu, 29 Apr 2010, Warren Block wrote:


One more problem: there should be a quote at the end of the last line.

attach 100 {
device-name "ugen[0-9].[0-9]";
match "vendor" "0x04b8";
match "product" "0x010a";
action "usb_devaddr=`echo $device-name | sed 's#^ugen##'` && \
chown root:saned /dev/usb/${usb_devaddr}.* && \
chmod 0660 /dev/usb/${usb_devaddr}.*"


Shouldn't there be a ; at the end of the action line also? Because every 
line above ends with it too. I also ended the total attach 100 statement 
with }; because that seems the case in the rest of devd.conf.


Yes, sorry about that.  Next time I'm going to post the whole section instead 
of trying to edit it down.


To see if these changes work I'll have to reboot later because I'm updating 
my ports, and this can take a while...


There's '/etc/rc.d/devd restart', but it's probably not something to 
experiment with during updates.


After the changes in devd.conf the scanner now works as user! It has the 
user as owner and saned as group.

Thanks for the help.

Regards,
Marco
--
The Poems, all three hundred of them,
may be summed up in one of their phrases:
"Let our thoughts be correct".
-- Confucius
___
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"