Preserving FTP existing target file permissions

Discuss new features and functions
Posts: 4
Joined: 1 Jan 2020

mc2

Great tool :-)

One small problem I've found is that when overwriting an existing file over FTP the permissions of the existing file aren't preserved.

E.g. cgi files on a web server have to have permissions of 755 (read-write-execute, read-execute, read-execute) but if you Update an existing doit.pl (which has the correct 755 permissions) its permissions are set to 664 -- importantly without the execute bits on, so requiring you to use an FTP program to correct them. (All of my FTP programs preserve the overwritten file's permissions.)

If there's an option/feature already in FreeFileSync to preserve overwritten files' permissions, I apologise for failing to find it and would appreciate being told where it is.

If not, then please consider this a bug report / feature request, as you deem appropriate :-)
User avatar
Site Admin
Posts: 7212
Joined: 9 Dec 2007

Zenju

Ist this about FTP or SFTP?
Posts: 4
Joined: 1 Jan 2020

mc2

It does the same with both FTP and SFTP.
User avatar
Site Admin
Posts: 7212
Joined: 9 Dec 2007

Zenju

I've added an option to set Unix file permissions during SFTP upload:
https://www.mediafire.com/file/ztkkl5lx73bmori/FreeFileSync_10.20_%5BBeta%5D_Windows_Setup.exe
Posts: 4
Joined: 1 Jan 2020

mc2

Ummm...well, ok, but it'd far better to make it preserve the permissions of the existing file(s) being overwritten, as not all files in the destination might have the same permissions. As I say, the FTP programs I use do that.

With the option you've added (thank you) I'd have to have two configurations for the same set of folders, one just for cgi scripts with 755 and one for everything else with 644.
User avatar
Site Admin
Posts: 7212
Joined: 9 Dec 2007

Zenju

Back to the drawing board... Maybe this scenario is better handled via a custom post-sync script.
Posts: 4
Joined: 1 Jan 2020

mc2

Hi again. Not sure if the "custom post-sync script" is a note to yourself or a feature of FFS that I haven't discovered yet.... :-)

It's been a veeeery looooooooooooong time since I faffed with the FTP protocol myself (in my youth, although I doubt it's changed much in the past few ummmm decades :-), but as I recall the LIST command gave all the basic properties of the files, including their permissions, so I'd have thought that you already have all the target permissions from doing the Compare.

So then it should (?) be just a matter of applying those if they're not already the default (644), I'd have thought, no? Be best to do it as each file is uploaded ... at least that's the way my FTP programs seem to do it. And, of course, you'll probably want to make it an option, "Preserve existing file permissions", alongside the default one you've added.... :-)