I've released another small update to ZitaFTP Server, which can be downloaded now. This version adds one new feature: you can set the permissions given to file uploads (and created directories). It's the result of one tester complaining that the execute bit isn't preserved when copying via FTP.

Here's the problem: the FTP protocol itself is missing the ability to preserve file attributes and metadata. You'd think that a protocol that was invented in the 1970s would have that capability by now, but it doesn't. There's a draft specification for adding it that was never adopted, and some servers have the non-standard "SITE CHMOD" command, which is adequate for posix systems such as Linux.

The reason that the FTP protocol doesn't have a method to preserve file attributes, is that they vary between operating systems. For example, AmigaOS' "script" bit is exclusive to AmigaOS. Windows won't allow files to have execute permission without at least read permission too, and MacOS also has its own metadata. As a result, there's no way to make the FTP protocol work universally. Sure, you could implement posix style permissions and attritbutes, but a simple copy to and from a Windows machine, and the permissions aren't preserved.

How to Work Around FTP Lacking File Attribute Support?

If you need to preserve file permissions/attributes, then I recommend archiving the files (e.g., in a *.lha file, or *.tar) before transferring them. The archive will preserve all file attributes, so all the permissions, timestamps, etc., will be correct. Alternatively, you can tell ZitaFTP to do what RC-FTPd does: set the execute bit for all file uploads. No, this won't preserve the file attributes, but at least executable files you copy will run without you needing to reapply the execute bit. Add the following to your ZitaFTP configuration file, in the [ServerConfig] section:

; Default file and directory permissions (uploads will have these permissions)
; These are *nix style permissions, e.g., 664 = user & group can read-write, everyone else can read only
default_file_permissions = 774
default_dir_permissions = 775

NOTE: Most AmigaOS file-systems are single-user, so the "group" and "other" permissions are ignored, unless you have a multi-user filesystem installed. Then, it would restrict execution and write access to the user and group.

Future Solution

ZitaFTP client software is planned for the future, and I do want it to be able to preserve all file attributes and metadata. Perhaps I could implement it by adding an archive format transfer mode, where files are automatically archived at one end, and unarchived at the other (with things such as symbolic links banned for security reasons). Either way, it'll be in the form of a ZitaFTP custom extension to the FTP protocol, because no suitable standard exists.

Implementation suggestions are welcome. I've disabled comments due to excessive spam, so please contact me here if you have alternative suggestions on how to preserve file attributes with FTP transfers.