Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Here's what I just noticed on my CentOS SSH account:

stat output
$ stat /dev/kvm   
  File: `/dev/kvm'
  Size: 0               Blocks: 0          IO Block: 4096   character special file
Device: 5h/5d   Inode: 39768216    Links: 1     Device type: a,e8
Access: (0666/crw-rw-rw-)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2014-07-12 13:50:33.015216048 +0200
Modify: 2014-07-12 13:50:33.015216048 +0200
Change: 2014-07-12 13:50:33.015216048 +0200
id info
$ id
uid=502(jacek) gid=502(jacek) groups=502(jacek)
strace output
$ strace -e open cat /dev/kvm
open("/etc/ld.so.cache", O_RDONLY)      = 3
open("/lib64/libc.so.6", O_RDONLY)      = 3
open("/usr/lib/locale/locale-archive", O_RDONLY) = 3
open("/dev/kvm", O_RDONLY)              = 3
cat: /dev/kvmopen("/usr/share/locale/locale.alias", O_RDONLY) = 4
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
: Invalid argument
ACL info
$ getfacl /dev/kvm
getfacl: Removing leading '/' from absolute path names
# file: dev/kvm
# owner: root
# group: root
user::rw-
group::rw-
other::rw-

Why did open succeed here? What mechanisms other than ACL can be used to tell whether a user can open a file or not? What are the commands I can use to query them?

share|improve this question

closed as off-topic by Gilles, d33tah, Braiam, goldilocks, Ramesh Jul 12 at 14:33

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Gilles, d33tah, Ramesh
If this question can be reworded to fit the rules in the help center, please edit the question.

    
Why you think open succeeded? –  Braiam Jul 12 at 13:06
    
@Braiam That's visible from the trace. The real question is, why are you surprised to have read permissions, when all the permission bits are rw? No matter what category you fall into (here: “others”), you have read and write access. –  Gilles Jul 12 at 13:08
    
Whoops, looks like you're right. I just assumed that it shouldn't be world-readable and didn't even read the permissions. Silly me. Voting to close. –  d33tah Jul 12 at 13:12
    
If you're wondering about the “Invalid argument” part, and why you would have permission to read a file but attempting to read it fails, that's a different (and interesting) question. –  Gilles Jul 12 at 13:13

1 Answer 1

What am I missing? /dev/kvm is world readable (and writable) as you can see from it's permissions:

user::rw-
group::rw-
other::rw-

There is no reason why you shouldn't be able to read it. Are you referring to something else?

share|improve this answer

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