Skip to content

Instantly share code, notes, and snippets.

@CraigJPerry
Created September 1, 2012 23:17
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save CraigJPerry/3590779 to your computer and use it in GitHub Desktop.
  1. There's no way to achieve this with simple permissions. Due to OpenSSH's sftp-server you won't be able to implement the full requirements list but depending on the filesystem the files are being uploaded to, you can leverage attributes and ACLs to achieve some of your requirements.

  2. Yes, the sftp-server takes a -u parameter (you can set this in your sshd_config on the Subsystem sftp line) which sets the umask for all uploads.

  3. Yes, you can make use of inotify, one way may be with the incron tool although there are many ways to use inotify. Inotify allows you to have the kernel notify a userspace program on a filesystem event you identify, e.g. adding a file to a directory. You can then run a command on this event.

(3 Part 2) An alternative approach that may not be suitable for you is to use something like vsftpd with SSL protected FTP. This allows for encrypted FTP but because vsftpd is a full featured FTP server it provides simple configuration (see the chown_uploads parameter in vsftpd.conf) to match your exact needs.

  1. Yes, via the inotify subsystem, you could register a watch for the IN_CLOSE_WRITE event.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment