DragonFly submit List (threaded) for 2005-03
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]
Re: chmod 660 on /dev/pass*
Okay,
>Well, make it three columns: device owner:gid permission.
It's late, but here's a first shot.
(1) The /etc/devperms.local config file:
---------------------------------------------
#################
# devperms.local test file
#################
# bacula-sd needs access to /dev/pass?, so grant rw permissions to
group.
pass* root:operator 660 # This space for rent
# Test entry: keep MAKEDEV's ownership and permissions
nsa0 root:operator 660
# Fridge access
fridge heinz:ketchup 644
(2) What could be appended to MAKEDEV:
------------------------------------------------
DEVPERM_FILE="/etc/devperms.local"
# No local device permissions file, so go home
[ -f $DEVPERM_FILE ] || exit
# Read stuff from file
cat $DEVPERM_FILE |
while read LINE
do
# Skip empty lines and comments
[ `echo $LINE | grep -c ^$` -eq 0 ] || continue
[ `echo $LINE | grep -c ^#` -eq 0 ] || continue
# Split current line into fields
set - `echo $LINE`
# Ignore lines with less than three fields
[ $# -ge 3 ] || continue
# Need a separator ':' in field #2 (owner:group)
[ `echo $2 | grep -c :` -eq 1 ] || continue
# Check if last char of field No.1 is an asterisk
DEVICE=`echo $1 | cut -d\* -f1`
FAMILY=`echo $1 | cut -d\* -f2`
# Just do it
if [ -z "$FAMILY" ]
then
# Set owner, group and permissions for entire device
family
ls -1 /dev/${DEVICE}* |
while read ENTRY
do
echo "Family: $ENTRY --> chown $2 --> chmod
$3"
#chown $2 $ENTRY
#chmod $3 $ENTRY
done
else
# Set owner, group and permissions for a single device
echo "Single: $DEVICE --> chown $2 --> chmod $3"
#chown $2 $DEVICE
#chmod $3 $DEVICE
fi
done
Could be beautified, but according to local time here, it's okay...and
works. (After getting rid of line wraps :)
--j
-----------------------------------------------------
who | grep -i blonde | talk; cd ~; wine; talk; touch;
unzip; touch; strip; gasp; finger; gasp; mount;
fsck; more; yes; gasp; umount; make clean; sleep
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]