The usbcam file

For convenience, here is my version of the /etc/hotplug/usb/usbcam file. You must make this executable by all, and must edit the USER variable to your username rather than mine. It is basically just the gphoto2/packaging/linux-hotplug/usbcam.user file from the gphoto2 source code distribution.

# $Id: usbcam.user,v 1.1 2002/03/22 23:48:59 hun Exp $
# /etc/hotplug/usb/usbcam
# Sets up newly plugged in USB camera so that just one certain user


# can access it from user space. (Replace root by the user 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 gphoto2 by running "gphoto2 --print-usb-usermap".
# b) run your camera software as the user given above
# c) a Linux kernel supporting hotplug and usbdevfs
# d) the hotplug package (
# In the usermap file, the first field "usb module" should be named 
# "usbcam" like this script.

if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ]
    chmod a-rwx "${DEVICE}"
    chown "${USER}" "${DEVICE}"
    chmod u+rw "${DEVICE}"