title: SFTP overwrite fails for user with group write access
body: <p>This is a really strange one. I have a Ubuntu server setup (12.04) with proFTPD, and I have turned on SFTP. I have a user I want to be able to edit a set of files. The files are owned by the user www-data and the group www-data. The files have permissions 664. The user is in the group www-data, and is able to view, and edit the files when connected over ssh through the shell. However, over SFTP, the user can view these files, but attempting to edit them causes SFTP to report permission denied, and then causes the file to be zero sized. The user is however, able to delete and move the files. Can anyone think of any reason why this might be happening? I have also tried changing the group ownership of the file to another group, and adding the user to that group, but the same issue occurs.</p>
  
  <p>The issue does not occur over regular FTP with proFTPD.</p>
  
  <p>Edit: As requested, the full text of the error (this is over sftp command line interactive mode):</p>
  
  <pre><code>Uploading /Users/leonaves/Desktop/testfile to /testfile
  remote open("/testfile"): Permission denied
  </code></pre>
  
  <p>Edit 2: ls -l output for home directory of user:</p>
  
  <p><a href="https://i.stack.imgur.com/w3kbp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/w3kbp.png" alt="ls -l output"></a></p>
  
  <p>Edit 3: SFTP log shows the following:</p>
  
  <pre><code>error changing permissions of '/testfile' to 0100644: Operation not permitted
  </code></pre>