Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

The logged in user is a member of a group that has a write permission on a folder. But when this user is trying to write something, "permission is denied".

The log below summarizes the question:

subv:/www/tracer/ whoami
frank
subv:/www/tracer/
subv:/www/tracer/ ls -ltr 
total 4
drwxrwxr-x 2 root tracer 4096 Jan 20 12:25 convert.tracer.com
subv:/www/tracer/ groups frank
frank : frank tracer
subv:/www/tracer/ > convert.tracer.com/test
-bash: convert.tracer.com/test: Permission denied
subv:/www/tracer/

Output of "ls -bail /www/tracer/convert.tracer.com/":

subv:~/ ls -bail /www/tracer/convert.tracer.com/
total 8
38010883 drwxrwxr-x 2 root tracer 4096 Jan 20 12:25 .
38010882 drwxr-xr-x 3 root root    4096 Jan 20 12:25 ..
subv:~/ 
share|improve this question
3  
The parent directories needs the permissions as well. –  Herman Torjussen Jan 20 '12 at 12:22
2  
does test file already exist? what are its permissions if so? –  Nikhil Mulley Jan 20 '12 at 12:28
    
Do you have SELinux activated? Can you also do an "ls -bail convert.tracer.no/" –  tmow Jan 20 '12 at 13:51
    
@hesse you mean, the group owner of "/www" and "/www/tracer" should be tracer? –  user11498 Jan 20 '12 at 14:02
    
@Nikhil no, there is nothing in "/www/tracer/convert.tracer.com/". Its an empty dir. –  user11498 Jan 20 '12 at 14:02

2 Answers 2

up vote 3 down vote accepted

Group membership is re-read on login. groups seem to report the groups you are in according to /etc/group and does not reflect membership of groups in the current session.

Use the command id -Gn to show the groups that you are currently an active member of. Solution: relogin to apply the group changes.

share|improve this answer

What about the permissions of the directory where you have the file?

Are you able to edit the file, i.e. with vim, and save it?

Try to do something like

chmod g+w .

UPDATE

subv:~/ ls -bail /www/tracer/convert.tracer.com/
total 8
38010883 drwxrwxr-x 2 root tracer 4096 Jan 20 12:25 .
38010882 drwxr-xr-x 3 root root    4096 Jan 20 12:25 ..

It could there was an issue while creating the tracer directory, I see strange spaces between root and 4096 in the second line of your output.

I would try this as root:

cd /www/tracer/
chown root:root .
chown root:tracer convert.tracer.com

If it's still ok, I'd check the group name in /etc/group, doing a

cat -v /etc/group

Checking that there are not non printable chars in root and tracer group

Finally if you still have the issue could be SELinux or an issue with the file system.

share|improve this answer
1  
ask questions in comments, not answers. He shows the permissions of the directory. If the shell cant write to it, neither can vim. The directory already has g+w perms. –  Patrick Jan 20 '12 at 13:12
1  
@Patrick yes, you are right... But if he cannot write on the file through a directory (convert.tracer.com/test) I was thinking the issue is the directory... I didn't see well in the log provided. –  tmow Jan 20 '12 at 13:38

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.