Not able to read a sysfs file

1.6k views Asked by At

I am trying to read the Machine Specific Registers (MSRs) by reading the sysfs files /dev/cpu/0/msr. It usually has read-write permissions for only the root. I update those permissions to 666 (of course using the sudo rights) and then try to read the file as a normal user. It doesn't allow me to do that. However, if I try to open the file with sudo it allows me to open the file and read.

I also tried to change the ownership of the file using chown command. Currently the status of the file is the following:

[my-user@machine-name]$ ls -l /dev/cpu/0/msr
crw-rw-rw-. 1 my-user root 202, 0 Oct 25 16:23 /dev/cpu/0/msr

Ehat do I need to do to access the file as a normal user?

1

There are 1 answers

2
Chemik On

As you can find in MSR man page:

This file is protected so that it can be read and written only by the user root, or members of the group root.

Here is similar question and you can find instructions how to grant permission to access these files there.