To Set Permission on USB Node "/Proc/Bus/Usb/bus-no/dev-no"

Discussion in 'Linux' started by Gurjeet Singh Batth, May 8, 2008.

  1. Gurjeet Singh Batth

    Gurjeet Singh Batth New Member

    Joined:
    Nov 1, 2007
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Software Engineer
    Location:
    Punjab
    Hi all,
    I am using CentOS 5 operating system. and trying to use a usb thermal printer.
    This Printer works well if I log in as a root user, but I want to use it in non-root user mode. I have put this non root user in lp group also.
    But No Success.

    My printer uses usb port listed under /proc/bus/usb/bus-no/dev-no directory tree.
    I want to set permission on it. [when I do it manually the printer starts working, but I don't want to do this in such way.] I need some automated way.

    Also I found some techniques to set rules and permissions on usb port. but those techniques set the permission for /dev/bus/usb/bus-no/dev-no. and are of no use for me.

    Please suggest me some good way to do so.
     
  2. aceqbaceq

    aceqbaceq New Member

    Joined:
    Jan 23, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    i had similar problem. fedora core 4. hp 1120 mfp. sane works only with root permissions.

    i used two files from packet iscan.

    first file

    /etc/hotplug/iscan-device , permissions = 755, root, root

    Code:
    ================
    #!/bin/sh
    
    DEFAULT_OWNER=root
    DEFAULT_GROUP=root
    DEFAULT_PERMS=0666
    
    USB_SCRIPTS="libusbscanner
                 usbscanner
                 desktopdev
                "
    for script in $USB_SCRIPTS; do
        if [ -x $HOTPLUG_DIR/$TYPE/$script ]; then
     exec $HOTPLUG_DIR/$TYPE/$script
        fi
    done
    
    # Activate fallback settings
    #
    if [ "$ACTION" == add -a "$TYPE" == "usb" ]; then
        chown $DEFAULT_OWNER:$DEFAULT_GROUP "$DEVICE"
        chmod $DEFAULT_PERMS "$DEVICE"
    fi
    =======================


    second file

    /etc/hotplug/iscan.usermap , permissions = 644, root, root

    Code:
    =========================
    
    # Hewlett-Packard | HP LaserJet M1120 MFP
    iscan-device 0x0003 0x03f0 0x5617 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
    ===================================
    
    
    in the second file actually important and individual for you is 0x03f0= Vendor_Id and 0x5617=Device_Id.

    change it for yours. how determine?
    # sane-find-scanner

    what it does to me. it sets automatically permissions=666 to file

    /proc/bus/usb/bus-no/dev-no - this file concern my scanner when scanner plugged. :) and as i have permissions 666 then i can run

    $xsane

    as user. :)

    hope this help.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice