0

I am user tim, in the bob group, and I have a file with unusual permissions:

$ whoami
tim
$ groups
lp wheel cron audio cdrom video bob tim
$ ls -l foo
--w--w-r--  1 bob bob   10 Feb 15 18:43 foo

Since the file foo is world readable, I should be able to read the file, but I can't.

$ cat foo
cat: foo: Permission denied

Is it possible for me to read the file as user tim? Steve can and I'm jealous...

$ whoami
steve
$ cat foo
secret!

I apologize for the bad title. I'm having a hard time succinctly describing the problem.

0

2 Answers 2

2

In Unix, the permissions are checked strictly in this order: If the user is the owner of the file, the owner permissions apply. If the user isn't the owner, but belongs to the file's group, group permissions apply. If the user isn't the owner or belongs to the group of the file, the other permissions apply. As a special case, root is allowed to do whatever she wants.

0
2

The problem is that you have explicitly set the file to not be readable by members of the group 'bob' and tim is a member of bob.

You need to either remove tim from the bob group, or set the group of the file to something tim is not a member of.

1
  • Or make the file group readable, which is probably most likely what you want. What sense does it make to make a file world readable and not group readable? (And the only choices are for that to do nothing or for that to prevent people in the group from reading. If you don't want it to prevent, why set it?) Feb 16, 2013 at 2:08

Not the answer you're looking for? Browse other questions tagged .