I have two users testuser2 and testuser1 with homedirectories /home/testuser2 and /home/testuser1 respectively. I want to share the directory /home/testuser1/Videos/ and its contents across these two users. I did the following :

  1. Created a group named ggg and added both users testuser2 and testuser1 to it
  2. Changed the ownsership of /home/testuser1/Videos to testuser1:ggg from testuser1:testuser1
  3. Set acl to group ggg having permission rwx on /home/testuser1/Videos
  4. Set sgid to the directory /home/testuser1/Videos

Now I created a soflink to /home/testuser1/Videos inside the directory /home/testuser2/Desktop/testuser1 so that both testuser1 and testuser2 would be able to add/edit/remove directories. While testing I came across the following scenarios which I would like to get clarification you guys.

A) Copying files by testuser1 :

I have copied a file from /home/testuser1 (say examplefile1 testuser1:testuser1 644 ) to /home/testuser1/Videos and I could see that the ownership of the file changed to testuser1:ggg successfully.

1.How can I change the permission also automatically to the one I need (group permision to rwx) if someone is copying files to my destination?

  1. If I am copying a file with 444 permission, then testuser2 wont be able to write to it. Thats normal since it is 444, but he is able to delete it. How ?

B) Moving files by testuser1 :

Comparing with the copying, while moving the files, ownership is not changing to testuser1:ggg. It keeps testuser1:testuser1 and keeps what the actual permission is.

  1. How can I change the permission AND ownership to the one I required automatically ?
  2. Same case as copying, testuser2 is able to delete the file but not able to write if the file is having permission read only.Why ?

I have tried to explain as possible. Please let me know the answers for A and B sections.

1 Answer 1



A1) man umask
A2) chmod +x permits delete, but not overwrite, because of -w

B1) The owner of a newly-created file is the creator, obviously, but the group is the primary group as specified in /etc/passwd. The fourth field for a user in /etc/passwd is the GID of his primary group. Knowing this, you could change the primary group to what you want, and use umask to give it the permissions you desire.
B2) same as A2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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