Www-data group and owner?

I have installed my first Ubuntu 20.04 server in a VM on VirtualBox. I have installed PHP and Apache to get me started creating a website. I am a little baffled about the owner and group set up for the /var/www/html directory which is setup to have www-data as it’s owner and group.
I want to be able to upload files and folders to the site using FileZilla. It does not appear to be getting the right owner and/or group for the files. I have read an article which says the permissions of the document root (the html folder) should have an s in the owner execution position in its permissions. I have been unable to understand how this works, except it allows files with any owner and group in the folder with the s in the owner execution position to be viewed by Apache.
What I am looking for is a simple explanation of the need for www-data owner and group.
I also need to understand the permissions setting if the s is in the group execution position.

You shouldn’t need to do anything special with permissions, the www-data user is the user that the web server itself runs on, so you want that to be the case because if a folder is open to everyone, then that is a security risk. If you’re using scp with Filezilla (preferred over FTP) then all you should have to do is add the user you’re using Filezilla with to the www-data group, and ensure the group permissions are set to allow the group to modify for the folder you’re uploading to. Also, you’d ensure that user is a member of the www-data group.

For example:

sudo usermod -aG www-data <filezilla username>

sudo chmod g+rwx <filezilla directory that receives uploads>

Many thanks for your expert reply. I did not state that my main machines are all Windows 10 only the server and a desktop are Ubuntu. The main use will be from a windows based FileZilla to upload files for execution on the server by the browsers on Windows PCs or VM PCs. Does this change your recommendation/s. I had not noticed an option in the Windows FileZilla client to use scp maybe I just haven’t looked hard enough.

I believe what Jay might be referring to is SFTP, the SSH FTP protocol that Filezilla supports. I don’t believe Filezilla supports SCP natively.

But regardless, when you log in to your server with Filezilla, there is a Logon Type, User & Password field in the site manager (see image below). This logs you in as a Linux user of your server, pretty much the same as a SSH connection! Once you log in and transfer your files, they will be created and owned by the user you logged in with, which is why Jay suggests adding your Linux account to the www-data group to prevent any possible file permission errors.

I did a little test, in my case the file I uploaded to my server got a permission string of 0644, but that might depend on your server configuration.