There are various ways to encrypt your data. For iCloud, you can create an encrypted disk image and store it on your iCloud Drive. The disk image can be mounted on your other Mac OS X devices. I have yet to try mounting it directly on iOS or iPadOS, though. A mounted disk image will work just like any other drive, but will automatically be encrypted when unmounted. This could have been the perfect single solution for me had it been easy to mount iCloud Drive on Linux, but isn’t that simple.
A more universal solution is to mount a remote storage using Webdav (or via SSH). The mounted webdav will function as another drive on your device. Unfortunately, this solution will not provide you with the privacy that you need, since files are not encrypted. Similar to the above, you can create an encrypted disk image and store it on the webdav drive, which means that you need to mount two images — webdav and the encrypted disk image. Looks a bit tedious, if you ask me, so a simpler solution is needed.
Enter rclone, an open source project that allows you to sync files and directories across a wide-array of online services, or simply put, it is “rsync for cloud storage”. This application is available on all popular desktop platforms, and installing it is very easy — almost one click (well, technically just press Enter once).
For my use, I used rclone to access a Webdav subdirectory off of my web hosting provider. With this available, I create an encrypted directory on the Webdav subdirectory with the options for encrypted directory and filenames.
Encrypted subdirectory and file names
Unlike a mounted drive, rclone accesses the different configured repositories on demand, i.e., the cloud storage is not always attached to your desktop.
rclone supports a variety of cloud storage services, including Google Drive, Microsoft OneDrive, Dropbox, and Amazon Drive (check the website for the complete list). You can now safely and privately store files on these services without fear that they might scan and analyze the contents of the files.
Currently, I am using rclone to sync encrypted images and meta-data of the photos that I backed up from my Flickr account. At least I know that my web hosting provider will not easily have access to my saved photos.