Is there a way to tell winscp to keep the group and permission of my upload file? I am tired of modifying webpages/webapp binaries and needing to change the group to www-data so the server can read them.

If not what app might i use instead? I mostly use winscp for the easy of copy/pasting files onto my linux server and the ease of browsing the filesystem (can go between 2+ folders in a second, no typos)

3 Answers
3

I'm guessing you're having the problem because WinSCP removes existing files before uploading new ones - which should never happen unless you do not have the 'write' permissions on the old file, in which case deleting and replacing is the only way for WinSCP to upload your files.

When creating a new file on Linux, the creator's primary group will be the file's group1, and the permissions will be calculated2 using (0666 & ~umask). The owner can modify permissions, but can only change the file's group into a group he himself belongs to.

In the case of a website, I usually set the setgid bit on the directories, so that all files I create inside become owned by that group:

'which should never happen unless you do not have the 'write' permissions on the old file' <-- Thats the thing, the directory is 777 and so are all the files. I do chmod -R 777 ./ constantly then when everything works i fix the bin folder permission
–
acidzombie24Dec 30 '10 at 21:04

You need to configure WinSCP not to transfer to temporary file (which is then renamed to the target file name). Then WinSCP will directly write to the target file, and keep the permissions/ownership intact.