How can I set persistent raw device permissions in Red Hat Enterprise Linux 4 or 5?

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 4 and 5

Issue

  • How can I set persistent raw device permissions in Red Hat Enterprise Linux 4 or 5?

Resolution

From Red Hat Enterprise Linux 4 on, udev is introduced which could help solve the problem. In Red Hat Enterprise Linux 4, /etc/udev/permissions.d is the directory where permission configuration file 50-udev.permissions is located. Red Hat Enterprise 5 uses a later version of udev and manages permission in the file /etc/udev/rules.d /60-raw.rules.

In Red Hat Enterprise Linux 4, here is the partial content of /etc/udev/permissions.d/50-udev.permissions:

# cat 50-udev.permissions 

# raw devices 
ram*:root:disk:0660 
raw/raw2:test:test:0660 
raw/*:root:disk:0660

It means that raw2 device's user is test and group also test while other raw devices' permissions is set by default.

Note: Don't put the raw2 line behind raw/* line because raw/* line will set all raw devices as default including raw2 device.

Then restart rawdevices:

# service rawdevices restart

# ls -l /dev/raw/ 
total 0 
crw-rw---- 1 root  disk 162, 1 Nov 21 16:05 raw1 
crw-rw---- 1 test  test  162, 2 Nov 21 16:05 raw2 
crw-rw---- 1 root disk  162, 3 Nov 21 16:05 raw3 

In Red Hat Enterprise Linux 5, permission is set in /etc/udev/rules.d /60-raw.rules file:

# cat /etc/udev/rules.d/60-raw.rules 
ACTION=="add", KERNEL=="raw*", OWNER=="root", GROUP=="disk", MODE=="0660" 
ACTION=="add", KERNEL=="raw2", OWNER=="test", GROUP=="test", MODE=="0660" 

After configuring, please restart udev:

# start_udev

# ls -l /dev/raw/ 
total 0 
crw-rw---- 1 root disk 162, 1 Nov 21 16:05 raw1 
crw-rw---- 1 test test  162, 2 Nov 21 16:05 raw2 
crw-rw---- 1 root disk  162, 3 Nov 21 16:05 raw3

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.