Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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 the following problem. On Unix server (CentOS 5.5) a number of users belonging to the same group have access to the same files (via ssh). After one particular user (let's say usera A) has edited the file the file owner is changed to A, the group (G) and the permissions (0664) remain intact. Once a second user (B) tries to modify the same file he is not allowed to do so. If on other hand the user B modifies the file then A can change it without problems (except screwing up the permissions).

I understand that there is something screwed up with the permissions/groups but I can't find out what. So any help would be appreciated.

Providing more information:

$ ls -l /path/file
-rwxrwxr-x 1 B G 42269 jan 14 10:30 file

$ getfacl /path/file
# file: file
# owner: B
# group: G

$ ls -ld /path
drwxrwxr-x 12 B G 4096 jan 14 10:24 .

$ getfacl /path
# file: .
# owner: B
# group: G
share|improve this question
Please provide output from ls -l /path/file; getfacl /path/file; ls -ld /path; getfacl /path; – dchirikov Jan 14 '13 at 9:00

A has permission to write to the directory, so A's editor writes a new file /path/file.tmp (or some similar name) then moves the new file to /path/file. Since A just created the file, it is owned by A.

B does not have permission to write to the directory, so B's editor overwrites the existing file, which does not change ownership.

(See How do I edit a file and preserve its access control list / SELinux security context? for some background on why editors do these things.)

It seems that A is in group G but B isn't. The easiest way of solving this would be to make sure that A and B are either both in group G or both not in group G.

share|improve this answer

Your Answer


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.