Can’t read a file although it’s in the group and permissions for group read are set

filesgroupnfspermissions

I encounter a strange problem on a unix/linux machine:

I'm member of a group, let's call it group A and a certain file (which has a different owner) belongs to group A as well. The permissions of that file are

-rw-rw----

so I'd expect I should be able to open that file, but I am not: I'll get the "Permission denied" error message when I try to look at the file's content (using cat).

Since the permissions seem to be correct, what else could be causing this? Are there "overriding" permission restrictions in place? If so, how would I find out?

Best Answer

Have you logged out and logged back in again since you were added to group A ?

If not, your current login processes will only have the group memberships that it had at the time of login, not any changes since. And any child processes of that login will have the same group memberships (i.e. if you logged into X then every application including your terminal emulator and shell)

You can test this by logging in again on another console or via ssh, or something like exec sudo -u $(id -u -n) -i (to effectively kill and replace the current shell with a new shell - any background processes belonging to that shell will be orphaned)

Related Question