Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
    
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
add comment

migrated from stackoverflow.com Feb 12 '13 at 11:55

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

1 Answer

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
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.