You are not logged in.

#1 2012-05-06 07:28:33

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,243

Permissions for files in /sys

Many files in /sys or /proc/sys are not readable (I get a "permission denied"), even as root. Now I do some experiment:

cat /sys/module/usbhid/uevent
cat: /sys/module/usbhid/uevent: Permission denied

and now:

[root@pcolivier /sys]# ls -l /sys/module/usbhid/uevent
--w------- 1 root root 4096 May  6 09:22 /sys/module/usbhid/uevent
[root@pcolivier /sys]# chmod a+r /sys/module/usbhid/uevent
[root@pcolivier /sys]# cat /sys/module/usbhid/uevent
cat: /sys/module/usbhid/uevent: Input/output error

There is something a don't understand in this. Normally we may read a file as root, whatever the permission of this file is (this is true for normal files). It seems here that the kernel enforces the permissions bits of the file in order to access it; without the read permission it denies access to the file, with the read permission it tries to read the file (and fails for another reason). My question how the permissions of the files in /sys are sets? Why they are enforced as root contrary to normal files?

Last edited by olive (2012-05-06 07:30:00)

Offline

Board footer

Powered by FluxBB