Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Using Fedora
FedoraForum Search

Forgot Password? Join Us!

Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 8th October 2004, 10:28 PM
Anjin Offline
Registered User
 
Join Date: Sep 2004
Posts: 15
Automating the chmod command to allow access to my scanner

In order to access my scanner as a user i first need to unplug it then re-plug it back in so my "libusbscanner" hotplug script executes a chmod command that gives users access to the scanner. My question is, where can i put the chmod command so that it i will not have to disconnect and reconnect the scanner in order to use it properly. Every "script" i've tried so far has either not worked or worked but the permissions did not "stick" when I logged in as user. Any suggestions would be greatly appreciated .
Reply With Quote
  #2  
Old 9th October 2004, 04:34 PM
Anjin Offline
Registered User
 
Join Date: Sep 2004
Posts: 15
Quote:
Originally Posted by Anjin
In order to access my scanner as a user i first need to unplug it then re-plug it back in so my "libusbscanner" hotplug script executes a chmod command that gives users access to the scanner. My question is, where can i put the chmod command so that it i will not have to disconnect and reconnect the scanner in order to use it properly. Every "script" i've tried so far has either not worked or worked but the permissions did not "stick" when I logged in as user. Any suggestions would be greatly appreciated .
fasdfasdfasfasd
Reply With Quote
  #3  
Old 9th October 2004, 04:54 PM
tashirosgt Offline
Registered User
 
Join Date: Aug 2004
Posts: 3,855
Where does one put a "hotplug" scipt? Are you talking about something like the scripts in this thread:
http://www.fedoraforum.org/forum/arc...p/t-19891.html
__________________
"Never let the task you are trying to accomplish distract you from the study of computers."
Reply With Quote
  #4  
Old 9th October 2004, 06:44 PM
Anjin Offline
Registered User
 
Join Date: Sep 2004
Posts: 15
The scipt i'm refering to in this post is in /etc/usb/hotplug/lubusbscanner and gets executed when i unplug and replug in my scanner. But i think there must be a cleaner way to accomplish the same thing. So my qeustion remains where can i put hte chmod command so that it will get executed when i log in as a user and allow me to use my scanner without having to unplug the device ???
Reply With Quote
  #5  
Old 9th October 2004, 10:30 PM
tashirosgt Offline
Registered User
 
Join Date: Aug 2004
Posts: 3,855
I see ( It's /etc/hotplug/usb/....). My guess about the script is to put it in /etc/profile.d, but I don't know for sure. I think all those scripts are run when one opens a terminal, but I don't know if they run when you do a graphical login.
__________________
"Never let the task you are trying to accomplish distract you from the study of computers."
Reply With Quote
  #6  
Old 10th October 2004, 01:16 AM
crackers's Avatar
crackers Offline
Retired Community Manager
 
Join Date: Feb 2004
Location: Seattle, WA, USA
Age: 56
Posts: 3,423
/etc/profile, /etc/bashrc, /etc/profile.d/* are all run when the login program is executed - which is when you login, either on a console or through the UI. The problem with putting it in there is the scripts are run suid (in other words, as the user logging in), so you won't be able to chmod the device.

I did some digging and came up with this file: /etc/security/console.perms - this seems to be the correct place to specify permissions granted to users on login. You might want to do some more research on this particular file before messing with it.
__________________
Linux User #28251 (April '93)
Professional Java Geek :cool:
Reply With Quote
  #7  
Old 14th October 2004, 03:26 AM
Anjin Offline
Registered User
 
Join Date: Sep 2004
Posts: 15
Snapscan USB Scanner finally working!!!

I was finally able to get my USB Snapscan scanner to work as a user without having to disconnect and reconnect the device. I've attached the contents of /etc/security/console.perms
which i finally got configured correctly to handle setting permissions to /proc/bus/usb/00*/00*
# /etc/security/console.perms
#
# This file determines the permissions that will be given to priviledged
# users of the console at login time, and the permissions to which to
# revert when the users log out.

# format is:
# <class>=list of regexps specifying consoles or globs specifying files
# file-glob|<class> perm dev-regex|<dev-class> \
# revert-mode revert-owner[.revert-group]
# the revert-mode, revert-owner, and revert-group are optional, and default
# to 0600, root, and root, respectively.
#
# For more information:
# man 5 console.perms

# file classes -- these are regular expressions
<console>=tty[0-9][0-9]* vc/[0-9][0-9]* :[0-9]\.[0-9] :[0-9]
<xconsole>=:[0-9]\.[0-9] :[0-9]

# device classes -- these are shell-style globs
<floppy>=/dev/fd[0-1]* \
/dev/floppy/* /mnt/floppy*
<sound>=/dev/dsp* /dev/audio* /dev/midi* \
/dev/mixer* /dev/sequencer \
/dev/sound/* /dev/beep \
/dev/snd/*
<cdrom>=/dev/cdrom* /dev/cdroms/* /dev/cdwriter* /mnt/cdrom*
<pilot>=/dev/pilot
<jaz>=/mnt/jaz*
<zip>=/mnt/pocketzip* /mnt/zip*
<ls120>=/dev/ls120 /mnt/ls120*
<scanner>=/dev/scanner /dev/usb/scanner* /proc/bus/usb/00*/00*
<rio500>=/dev/usb/rio500
<camera>=/mnt/camera* /dev/usb/dc2xx* /dev/usb/mdc800*
<memstick>=/mnt/memstick*
<flash>=/mnt/flash*
<diskonkey>=/mnt/diskonkey*
<rem_ide>=/mnt/microdrive*
<fb>=/dev/fb /dev/fb[0-9]* \
/dev/fb/*
<kbd>=/dev/kbd
<joystick>=/dev/js[0-9]*
<v4l>=/dev/video* /dev/radio* /dev/winradio* /dev/vtx* /dev/vbi* \
/dev/video/*
<gpm>=/dev/gpmctl
<dri>=/dev/nvidia* /dev/3dfx*
<mainboard>=/dev/apm_bios

# permission definitions
<console> 0660 <floppy> 0660 root.floppy
<console> 0600 <sound> 0600 root
<console> 0600 <cdrom> 0660 root.disk
<console> 0600 <pilot> 0660 root.uucp
<console> 0600 <jaz> 0660 root.disk
<console> 0600 <zip> 0660 root.disk
<console> 0600 <ls120> 0660 root.disk
<console> 0666 <scanner> 0600 root
<console> 0600 <camera> 0600 root
<console> 0600 <memstick> 0600 root
<console> 0600 <flash> 0600 root
<console> 0600 <diskonkey> 0660 root.disk
<console> 0600 <rem_ide> 0660 root.disk
<console> 0600 <fb> 0600 root
<console> 0600 <kbd> 0600 root
<console> 0600 <joystick> 0600 root
<console> 0600 <v4l> 0600 root
<console> 0700 <gpm> 0700 root
<console> 0600 <mainboard> 0600 root
<console> 0600 <rio500> 0600 root

<xconsole> 0600 /dev/console 0600 root.root
<xconsole> 0600 <dri> 0600 root

i added /proc/bus/usb/00*/00* to the end of the <scanner> line

I also changed the permissions for scanner from 0600 to 0666 (but 0660 will probably also work)

Restarted my system, logged in as user and voila xsane came up perfectly.

Hope this is of some help to those other newbies struggling to get their devices configured correctly.

If you unplug or disconnect your device during the session you may have to add a chmod command to /etc/hotplug/libusbscanner in case permissions get reset... heres my copy of libusbscanner

#!/bin/bash
# $Id: libusbscanner,v 1.1 2004/05/04 13:05:27 twaugh Exp $
#
# /etc/hotplug/usb/libusbscanner
#
# Sets up newly plugged in USB scanner so that the user who owns
# the console according to pam_console can access it from user space
#
# Note that for this script to work, you'll need all of the following:
# a) a line in the file /etc/hotplug/usermap that corresponds to the
# camera you are using.
# b) a setup using pam_console creates the respective lock files
# containing the name of the respective user. You can check for that
# by executing "echo `cat /var/{run,lock}/console.lock`" and
# verifying the appropriate user is mentioned somewhere there.
# c) a Linux kernel supporting hotplug and usbdevfs
# d) the hotplug package (http://linux-hotplug.sourceforge.net/)
#
# In the usermap file, the first field "usb module" should be named
# "libusbscanner" like this script.
#

if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ]
then
# New code, using lock files instead of copying /dev/console permissions
# This also works with non-gdm logins (e.g. on a virtual terminal)
# Idea and code from Nalin Dahyabhai <nalin@redhat.com>
if [ -f /var/run/console.lock ]
then
CONSOLEOWNER=`cat /var/run/console.lock`
elif [ -f /var/lock/console.lock ]
then
CONSOLEOWNER=`cat /var/lock/console.lock`
else
CONSOLEOWNER=
fi
if [ -n "$CONSOLEOWNER" ]
then
chmod 0000 "${DEVICE}"
chown "$CONSOLEOWNER" "${DEVICE}"
chmod 0600 "${DEVICE}"
chmod a+rw /proc/bus/usb/00*
fi
fi

Regards
Reply With Quote
Reply

Tags
access, automating, chmod, command, scanner

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to access webcam and fingerprint scanner in acer tm 4720 in fedora 9 ghataknav Hardware & Laptops 0 10th April 2009 04:52 AM
Command to know last access and modification time tech291083 Using Fedora 2 12th May 2007 02:33 PM
"chmod" command question d_GeNeRiT Using Fedora 5 10th September 2006 10:51 AM
Allowing user access of shutdown command Hououtate Using Fedora 3 4th April 2006 12:08 AM
Scanner access via network technoshaun Servers & Networking 0 2nd December 2005 11:55 PM


Current GMT-time: 23:47 (Friday, 24-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat