Thursday, July 1, 2010

Setting udev permission in CentOS5 for Bacula

If you use Bacula and wonder why your changer device (/dev/sgX) has wrong permissions, you must understand that udev is responsible on RedHat/Fedora for setting up the device nodes in /dev.

To change the group and permission of your changer device, add a script which sets the group and permission for your changer device.

Example for /dev/sg1:

vi /etc/udev/rules.d/55-bacula.rules


# fix the permissions of the standard devices to group "disk" (which bacula is a
 member of)
KERNEL=="sg[0-9]*", BUS=="scsi", MODE="0660", GROUP="disk"


Then reboot your server.

After reboot, you see the changed group on the sg devices:


# ls -al /dev/sg*
crw-rw---- 1 root disk 21, 0 Sep  8 14:42 /dev/sg0
crw-rw---- 1 root disk 21, 1 Sep  8 14:42 /dev/sg1
crw-rw---- 1 root disk 21, 2 Sep  8 14:42 /dev/sg2
crw-rw---- 1 root disk 21, 3 Sep  8 14:42 /dev/sg3
crw-rw---- 1 root disk 21, 4 Sep  8 14:42 /dev/sg4
crw-rw---- 1 root disk 21, 5 Sep  8 14:42 /dev/sg5
crw-rw---- 1 root disk 21, 6 Sep  8 14:42 /dev/sg6