Google Drive messing with Ubuntu permissions

Nextcloud 21.0.1
Operating system and version Ubuntu 20 & Windows 10/Server 2019
Apache 2.4.41
PHP version 7.4.3

Windows Server 2019 has the folder “D:\NextcloudData” - Shared as ‘NextcloudData’.
NextcloudData share is mounted in Ubuntu under /mnt/nextclouddata using FStab.
/mnt/nextclouddata is used as external storage for my nextcloud.

Google Backup and Sync (Now called Google Drive for Desktop) backs up D:\NextcloudData to google drive.

The idea is that

  1. Desktop clients sync with my nextcloud server
    2 The data is accessible in my windows environment under D:\NextcloudData
  2. The data also automatically uploaded/backed up to Google Drive.

This setup has worked fine for years. The only issue that occurred was when I shared a folder in google drive - It would sync back down to my NextcloudData folder and break the permissions in Ubuntu, and removing write access from www-data… I learnt to deal with this, as typically after I’d shared a folder the data in it was finalised anyway so write access wasn’t a big deal.

The issue I’m facing now is that after upgrading from ‘Backup and Sync’ to Google drive for desktop’, which I expected to work exactly the same way, the permissions break regardless of whether a folder is shared on google drive or not.

Steps to replicate it and then fix it, then break it again:

  1. Create folder/file on windows client machine (or via nextcloud web gui).
  2. Receive error from windows nextcloud client, saying that it cannot sync that folder/file because it doesnt have permission.
  3. Go on windows server, exit/quit Google Drive
  4. ssh into ubuntu and run chmod -R 755 /mnt/nextclouddata
  5. Check back on folder/file with permissions error - Working as expected.
  6. Folders and file continue to sync as expected without permission issues.
  7. Go back on windows server, open/turn Google Drive back on
  8. Create folder/file on windows client machine (or via nextcloud web gui).
    9 . Recieve permissions error.

**Output from ls -l in my nextclouddata folder when broken and Google Drive active -

dr-xr-x— 2 www-data www-data 0 Sep 14 20:04 ‘Media Projects’

**Output after turning off Google Drive, and chmod the permissions -

drwxrwx— 2 www-data www-data 0 Sep 14 20:04 ‘Media Projects’

**Turn Google Drive back on, wait for it’s initial file scan to finish after starting -

dr-xr-x— 2 www-data www-data 0 Sep 14 20:37 ‘Media Projects’

I’m really not sure what to do… I know this isn’t Nextcloud’s fault, but why Google Drive, installed in a windows environment is affecting folder permissions mounted in Ubuntu is absolutely stupid.

But maybe your setup is, I wouldn’t say stupid, but at least overcomplicated :wink: Why manage the Nextcloud data folder from a Windows machine, from which Google Drive also accesses it. Why not decide to use Nextcloud as it is intended and not access it via Windows Share and then have a third party client mess with the data.

If you want to do backups to Google Drive you could use something like Rclone directly on the Linux server. That would be much more efficient than a sync client on a Windows machine where the Nextcloud data folder is mounted via SMB. In addition to that, Rclone can also do encrypted the backups. I mean why using Nextcloud, when your data ends up unencrypted on Google Drive anyways? Then you could use the Google Apps in the first place :wink:

I would strongly recommend you to overthink and simplify your setup and workflows. Good luck.

1 Like

Thanks for the reply!

It’s a weird one, I guess I know what I want to happen, but the way I’ve done it doesn’t make sense to some.

I like having access to the files directly in a Windows environment, but need the benefits of local syncing like nextcloud. If I just used Google apps it would unnecessarily uses WAN traffic for syncing large amound of data =/

In the mean time 'll take a look at Rclone though thanks.

1 Like

If you want to have access to the data on the Nextcloud server via Windows Share, I would recommend you to go the other way around and mount the corresponding folders via External Storage App in Nextcloud. Accessing the Nextcloud data folder directly via SMB, or literally in any way, is not a good idea. It’s ok to do so sporadically in order to move larger amounts of data to the server. Working with the data like this is a bad idea and letting a third party sync client write to it is really bad :wink:

In the end, it all comes down to use cases and using the right tools for the job. Nextcloud is primarily meant to be a (local) alternative to the Google Cloud and traditional file shares like Windows shares. That’s why it can only interact with those services to a limited extent. In particular it can make those services available inside of Nextcloud, e.g via the External Storage app but not necessarily the other way around.