Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to write a script that examines memory usage for running processes. To do this, it needs to read /proc/*/smaps files.

Processes owned by root have the permission set to '-r--r--r--', which should be readable by everyone, right?

example output of ls -l [EDIT: now with directory permissions]

ls -l /proc/939/smaps
-r--r--r-- 1 root root 0 2012-07-11 12:11 /proc/939/smaps

ls -ld /proc/939/smaps
-r--r--r-- 1 root root 0 2012-07-11 12:11 /proc/939/smaps

attempt to read:

cat /proc/939/smaps
cat: /proc/939/smaps: Permission denied

is there something obvious I'm missing here?

EDIT2: On further investigation, other files, such as /proc//cmdline, are readable, so it might just be a special case for the smaps file?

share|improve this question
    
check the permissions of the parent directory –  steve Jul 11 '12 at 20:10
    
sorry I didn't include those before. the directory is also readable, and I can ls in the directory. –  YenTheFirst Jul 11 '12 at 20:18
add comment

1 Answer

Considering there is sensitive information in the data exposed via the /proc filesystem (e.g., command-line parameters, contents of process memory, etc.), I would say the permissions are irrelevant (especially given that those aren't real files anyway). I makes sense that only root can read the data for processes running as root.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.