Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

The problem is, they're all creating files for the website and I always have to change the group to www-data so they have permission to it. I can run a cron job, but that seems like a ghetto fix. The users are creating a file locally and just transferring it via SFTP through programs such as Transmit. I am sure I am not the only one having this problem, so I wanted to know how others handled it.

This is the setup I used:

share|improve this question
up vote 4 down vote accepted

Set the group of the directory to the group you want and then set the sgid permission bit. That should do the trick.

$ chgrp ftpusers /data/ftp
$ chmod g+s $_
share|improve this answer
What is $_? Also, I thought this was a pretty good explanation of sgid: – Doug Dec 2 '11 at 8:03
Oh wow! Interesting, it is the first argument of the last command. That is really new to me! – Doug Dec 2 '11 at 8:06
The $_ is also new to me, but this is the LAST argument of the previous command – f4m8 Dec 2 '11 at 8:47
Sorry, probably seems cryptic for people unfamiliar to the syntax. Should have used the folder name instead. But I suppose I underhandedly introduced something to some people ;-) – Belmin Fernandez Dec 2 '11 at 9:56

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.