X and file permissions

Andras Simon szajmi at gmail.com
Sun Jan 20 16:18:45 UTC 2013


Is it possible that X somehow makes a file inaccessible not when
it's running but only when it (X) is shown?

Here's what happens:

In a virtual console,

$ cat /dev/snd/controlC0 [just to see if it's accessible]

returns

cat: /dev/snd/controlC0: File descriptor in bad state (in a VC)

so the file is accessible - that's all that matters now. (Of
course, it's not an ordinary file, and given its permissions:

crw-rw----+ 1 root audio 116, 5 Jan 20 02:34 /dev/snd/controlC0

and that the user I'm doing this as is not in the audio
group, I find this result surprising - but since it's
the one I want, I won't worry about it for now :-))

However, if I do

$ sleep 10 ; cat /dev/snd/controlC0

and then switch to X (which has been running all the time), wait
for more than 10 secs and switch back, I see

cat: /dev/snd/controlC0: Permission denied

(Meanwhile, the permissions are still crw-rw----+)

It doesn't matter if X is just an X server, or a full xfce
desktop.

And lsof doesn't show anything that's using /dev/snd/controlC0

All this is interesting for me because I'm trying to find out the
reason why sound works in a VC but not in X, and strace led me
in this direction.

I'd appreciate any insight or hints about this.

Andras


More information about the users mailing list