linux set file permissions on boot

Soldato
Joined
29 Oct 2005
Posts
3,298
Hi guys, i need to set the permissions on all my input devices to a=rw as i am using the griffin powermate and the gizmod program. at the moment i have to change them manually each time i log in as the script i made doesn't seem to work

i was wondering if there was a way to make the permissions permanent or to permanently change ownership of these files to me from root?

thanks

Code:
Script Code:

# !/sbin/bash 
cd /dev/input 
sudo chmod a=rw event0 
sudo chmod a=rw event1 
sudo chmod a=rw event2 
sudo chmod a=rw event3 
sudo chmod a=rw event4 

/usr/local/bin/gizmod &


daven
 
Depends on the exact distro, but if you're using a modern udev-based distro running 2.6 kernel, you'd set the permissions from the udev rules. On my system (gentoo) thats /etc/udev/rules.d/50-udev.rules

find the rules with NAME="input... and change the MODE option to 0666, or, possibly safer, add a new group like 'inputusers', set the MODE to 0660 and the GROUP to inputusers on the udev rules.

Code:
/etc/udev/rules.d/50-udev.rules:

# input devices
KERNEL=="event*",       NAME="input/%k", MODE="0666"
 
I'm not Linux expert but wouldn't the device be shown as mounted in /etc/fstab?
So in options you could have something like this:

defaults,umask=0000

This is the same as chmod 777 *device* but run each time when mounted, so when you start up.
 
Last edited:
Back
Top Bottom