这是我刚刚在 CentOS SSH 帐户上注意到的内容:
统计输出$ 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
uid=502(jacek) gid=502(jacek) groups=502(jacek)
跟踪输出
$ 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
访问控制列表信息
$ getfacl /dev/kvm
getfacl: Removing leading '/' from absolute path names
# file: dev/kvm
# owner: root
# group: root
user::rw-
group::rw-
other::rw-
为什么open
在这里成功了?除了 ACL 之外,还有什么机制可以用来判断用户是否可以打开文件?我可以使用哪些命令来查询它们?
答案1
我缺少什么?/dev/kvm
从它的权限中可以看出,它是世界可读(和可写)的:
user::rw-
group::rw-
other::rw-
您没有理由不能阅读它。你指的是别的东西吗?