2

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: http://library.linode.com/security/sftp-jails

Strawberry
  • 1,132
  • 4
  • 15
  • 27

1 Answers1

4

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 $_
Belmin Fernandez
  • 10,799
  • 27
  • 84
  • 148
  • What is `$_`? Also, I thought this was a pretty good explanation of sgid: http://www.cyberciti.biz/faq/unix-bsd-linux-setuid-file/ – Strawberry Dec 02 '11 at 08:03
  • 1
    Oh wow! Interesting, it is the first argument of the last command. That is really new to me! – Strawberry Dec 02 '11 at 08:06
  • The $_ is also new to me, but this is the *LAST* argument of the previous command – f4m8 Dec 02 '11 at 08: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 02 '11 at 09:56