I have a directory that multiple users have access to. They change, upload, and delete files in the directory. They all belong to the same user group. The files in the directory have access rights of 660.
The problem is that the users cannot set the modification time of files if they're not the owner of that file.
For example user AAA uploads a file 'EXAMPLE.jpg', user BBB downloads it, modifies it and uploads it again. The file's 'last modified' timestamp will be of the time BBB uploaded it, not when it was really last modified. I tried setting the file's permissions to 777, but it didn't help.
The problem shows in sftp-logs as:
Dec 5 16:37:08 servername sftp-server[695]: open "/shared_directory/EXAMPLE.jpg" flags WRITE,CREATE,TRUNCATE mode 0666
Dec 5 16:37:08 servername sftp-server[695]: close "/shared_directory/EXAMPLE.jpg" bytes read 0 written 42765
Dec 5 16:37:08 servername sftp-server[695]: set "/shared_directory/EXAMPLE.jpg" modtime 20111205-15:53:31
Dec 5 16:37:08 servername sftp-server[695]: sent status Permission denied
Winscp will complain at the situation as Upload of file 'example.jpg' was successful, but error occurred while setting the permissions and/or timestamp. If the problem persists, turn on 'ignore permission errors'
. The warning can easily be ignored, but what if I want to allow my users to "preserve" the timestamps by editing them after file upload?
There is already a similar question than this, but has gone unanswered :(.