#!/bin/bash # $Id: usbcam.group 6766 2003-09-16 16:42:44Z hun $ # # /etc/hotplug/usb/usbcam # # Sets up newly plugged in USB camera so that only members of the # group GROUP=plugdev # can access it from user space. (Replace camera with the name of the # group you want to have access to the cameras.) # # 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. You can get the correct lines for all cameras # supported by libgphoto2 by running "print-usb-usermap". # b) a group "camera" where all users allowed access to the # camera are listed # 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 # "usbcam" like this script. # #echo "Action: ${ACTION}, device: ${DEVICE}, devpath: ${KERNEL}" >> /tmp/usbcam.log #set >> /tmp/usbcam.log if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ] then chmod o-rwx "${DEVICE}" chgrp "${GROUP}" "${DEVICE}" chmod g+rw "${DEVICE}" fi if [ "${ACTION}" = "add" ] && [ -c "${DEVNAME}" ] then chmod o-rwx "${DEVNAME}" chgrp "${GROUP}" "${DEVNAME}" chmod g+rw "${DEVNAME}" fi