Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have created a new admin group which I am a member of. I have changed permissions of the file test_admin.txt so that it can only be read and written by members of this group: ls -a returns

----rw---- 1 joe.bloggs admin     37 Feb  6 16:49 test_admin.txt

groups joe.bloggs returns

joe.bloggs : linkmed admin

I have logged out and back in as suggested by Why can't I write eventhough I have group permissions? but I still receive the same error message

test_admin.txt: Permission denied

What am I doing wrong?

share|improve this question

migrated from Feb 12 '13 at 11:55

This question came from our site for professional and enthusiast programmers.

There are many possibilities but where's the file? Permissions there? Device (could be mounted read-only) / Dir (not even getting there) ? – Tommi Kyntola Feb 12 '13 at 10:15
@TommiKyntola The file is in my home area where I have user permissions. How do I check if the device is mounted read-only? – moadeep Feb 12 '13 at 10:19
The answer below is correct. You're accessing it as joe.bloggs, right? Then you need to give him some access rights, too. Make it 660, i.e. chmod 660 test_admin.txt or chmod u+rw test_admin.txt. – Tommi Kyntola Feb 12 '13 at 10:23
up vote 4 down vote accepted

The user himself does not have the permission to view the file. The user permissions have precedence over the group permissions. Set the file readable for its owner as well.

share|improve this answer
I can now access the file, although the others in the group cannot – moadeep Feb 12 '13 at 10:36
@moadeep: How did you set the permissions? What are the permissions now? – choroba Feb 12 '13 at 10:39
To set up the group groupadd -r admin usermod -G admin joe.bloggs usermod -G jane.bloggs. To change group ownership of the file chgrp admin test_admin.txt chmod g+rw test_admin.txt. I then gave myself read write permissions as suggested by yourself chmod 660 test_admin.txt – moadeep Feb 12 '13 at 10:46
@moadeep: It should work. Do the other group members have the persmission to get to the directory? – choroba Feb 12 '13 at 10:50
They should do - everyone has access to the directory drwxrwxr-x 4 bill.bloggs all 166 Feb 11 10:00 admin/ – moadeep Feb 12 '13 at 10:55

You must log in to answer this question.