I have a home server that stores my files and I access the files in my internal network with samba. I have 3 users and each user has its home folder on /home/user.

In order to access the files from outside, I'm using a web based file explorer. The file explorer can login into these 3 user accounts and see the data, because I set the /home/user folder permissions to 770 and added the wwwrun user to the group of the desired user.

For example, the user John home folder is /home/john and this folder is owned by john:john with permissions 770. The john group contains users john and wwwrun.

The problem is when I upload any file via the web file explorer. I can upload the files to /home/john folder, but the file ownership is wwwrun:john. I want the upload files to be automatically owned as john:john with permissions 770.

How I can do this?


It sounds like you're describing the setgid bit functionality, where when a directory that has it set will force any new file created within it to have their group set to the same group that's set on the parent directory.

To make new files inherit the group of the container folder do:

$ chmod g+s thefolder

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.