The easiest way to solve the permission problem is to create a "mount" partition, inside the home partition. I am lazy to type so I use a directory called "U"
Code:
$ sudo mount /dev/cd0a U
I modified your script:
Code:
#!/bin/sh
DEVCLASS=$1
DEVNAME=$2
case $DEVCLASS in
2) # disk devices
case $DEVNAME in
*) echo $(date) : DEVCLASS: $DEVCLASS >>/tmp/debug.attach.txt 2>&1
echo $(date) : DEVNAME : $DEVNAME >>/tmp/debug.attach.txt 2>&1
esac
esac
When I plug in an USB memory stick I get this in
/tmp/debug.attach:
Code:
[adriaan@hercules]~: cat /tmp/debug.attach.txt
Wed Jan 9 02:41:21 CET 2013 : DEVCLASS: 2
Wed Jan 9 02:41:21 CET 2013 : DEVNAME : sd0
When I put a CD or DVD in my DVD rewriter nothing is being written to that file.
Even the following attach script does not produce anything on inserting a CD.
Code:
#!/bin/sh
cat <<END >>/tmp/debug.attach.txt
$(date)
--------------------------------
$(env)
--------------------------------
$(set)
--------------------------------
END
So no event is happening, thus no running of the script