File permissions on Nextcloud?


I am working through trying to get my RPi Ubuntu Server + Nextcloud Snap to sync with my new AL installation on the lappy. I’m making progress (thanks @GreenMartian )

As part of this I am now looking at permissions

I don’t understand why all my folders and files seem to have executable permission for owner, group and others.

For example, on the RPi ( root root is what I am expecting):

drwxr-xr-x 33 root root      4096 Oct 12 10:26 'Audio Books'
drwxr-xr-x  9 root root      4096 Oct 12 10:34  Boats
drwxr-xr-x  4 root root      4096 Dec  2 09:00 'Calibre Library'
drwxr-xr-x 12 root root      4096 Feb 15 12:15  Cars
-rwxr-xr-x  1 root root     13352 Aug 28  2014 'Change Residencia Authorisation.docx'

On the new lappy the permissions are identical (except for leigh users, as expected), again perhaps expected as I have been syncing these files between the old ASUS lappy and RPi Nextcloud for years.

The thing is, I don’t understand why all items have executable status, neither if they should do.

It is entirely possible that I did this in the (distant as I have no memory of it) past with a global chmod, or is this something that the system does so that when you click on an .pdf file (for example) it opens with atril or whatever?

Can anyone clarify for me please?


I did some tests with new files and folders to eliminate the possibilitiy that I had somehow used chmod before:

I made some new folders, one I made on the Lappy and then synced with Nextcloud, the other I made on Nextcloud (via web interface) and then synced with the lappy, both had the same permissions, with executable for all:

drwxr-xr-x  2 root root      4096 Feb 16 09:24 'Folder Created on Lappy'
drwxr-xr-x  2 root root      4096 Feb 16 09:19 'Folder created on Nextcloud'

I then made some new files, one I made on the Lappy and then synced with Nextcloud, the other I made on Nextcloud (via web interface) and then synced with the lappy, both had the same permissions, which didnt have executable this time:

-rw-r--r-- 1 root root 0 Feb 16 09:18 'Created on Lappy.txt'
-rw-r--r-- 1 root root 4 Feb 16 08:51 'Created on'

Are you running an up-to-date Snap & do you connect as root? There have been periodic issues with the Snap version. You could try a flatpak or Docker alternative.

1 Like

Very up to date snap. See extract from my Joplin ‘Nextcloud’ note at end of this post

I am pretty sure it is an issue with certain files / folders in the sense of problematic file-types &/or conflicts &/or &/or permissions

Other than this sync problem its all working perfectly.

And to install it is so straightforward:

Install Ubuntu Server on SD Card:

Get Ubuntu Server for Raspberry Pi from here

Use gnome-disks to restore image to SD card in Lappy

Log in to Raspberry Pi 3 running Ubuntu Server via ssh.

ssh ubuntu@192.168.1.XX

Default password is ‘ubuntu’

Once in, will be told to change password

Update Server:

sudo apt update
sudo apt full-upgrade

Install Nextcloud Snap

sudo snap install nextcloud

Make sure Snaps are up-to-date (including Nextcloud) and reboot.

sudo snap refresh
sudo reboot


Nice tutorial @leigh.

Logically, it’s a conflict of permissions. Typically, you should be able to chown your entire diectory on the server.

You could back up those files, and reinstall/reharden a fresh server. You shouldn’t need it with a Ubuntu LTS, however you have been in construction mode. That may clear up any conflicts in a shorter period of time.

1 Like

There’s much more in my Brain substitute note :rofl:

Get Data on External Disk

  • Shut down Box via ssh sudo shutdown now
  • Connect Box HDDs to Laptop with USB

Copy files with cp -pr

NB: Remember to mount Externaldisk first (in Thunar is easiest)

sudo mkdir /run/media/leigh/Externaldisk/Work
sudo mkdir /run/media/leigh/Externaldisk/Leighs\ Documents

sudo cp -pr /run/media/leigh/Work/Work/* /run/media/leigh/Externaldisk/Work
sudo cp -pr /run/media/leigh/Documents/Leighs\ Documents/* /run/media/leigh/Externaldisk/Leighs\ Documents

Re-connect Box

  • Reconnect and re-start Box
  • Access via SSH

Change Permissions

sudo chown -R root:root /media/Externaldisk

Scan files into Nextcloud

sudo nextcloud.occ files:scan --path="Leigh/files/Externaldisk/Work"
sudo nextcloud.occ files:scan --path="Leigh/files/Externaldisk/Leighs Documents"


I have done complete reinstalls 3 or 4 times, so far! :rofl:

I Grsync backup everything on my Lappy to a HDD every day, and to another every Friday

The Nextclud (I will leave that typo) is kind of a backup too - it just keeps my Lappy docs synced with my RPi
I think I am using NC as it wasnt meant to be used

Getting there, but its kind of sensitive to content for sync
Once it works once it generally behaves

strangely I can sync all the individual folders in My Docs, and sync My Docs with the subfolders ignored at sync creation stage, but if I try to sync My Docs with all the subfolders in - it crashes

I have come across numerous '‘illegal’ files (e.g. .htaccess) / corruptions / permissions that I have had to correct so far - so I am sure its not just one thing (it never is is it, à lá 3 Mile Island - maybe I shouldnt have used that eg :rofl:)

Like I said, it worked fine before and everything else is fine except sync so I am going to stick with this setup.

1 Like

You might be on to something here @leigh. Since your NC is a server instance, you’re probably without a GUI. You must be using the NC App to backup your files.

In terms of an independant sync via terminal, I would assume that this would cause you some heartache.

Syncing outside of NC on your server is obviously an entire seperate process.

I think I confused you

The Grsync is just to back up my stuff to two external HDD’s (one daily, one weekly)

Then, separately, and in addition to, the above backup HHD’s mentioned above, I have a ‘real time’ sync from Lappy to Nextcloud RPi (the latter of which uses a third external HDD)

I use the Snappy on the Pi, which has the bog standard Nextcloud Web interface, and I have the Linux Nextcloud client on the Lappy. All very standard.

I even tried it once, using the Win 11 nextcloud client, but same problems

I have jsut completely tidied up my file struture and so will next try to sync it in smaller chunks

I’m still baffled why all my files on my lappy (and hence those copied to my Nextcloud are executables tho, and if I should take these off via chmod (but then what about the ones that should have x ?)

Complicated, but I see what you’re trying to do.

The Grsync stuff works fine. The laptop to NC does not. This is the dual boot?

Is your formatted file system on the laptop the same as your server? Win is NTFS with similar permissions. Assuming your laptop is a combo of WIn/Linux, you’ll have two seperate file systems there with corresponding permissions and your NC / Ubuntu server will have it’s own file system, with corresponding permissions.

Remember, anything you have formatted Fat32 will have 4GB file limits. ExFat will not.

1 Like

Lappy data partitions are NTFS as I have AL / Win 11 dual boot
RPi Ext disk is Ext 4

Lappy - NC sync worked fine with same setup on previous lappy (& files were cp -rp from old to new lappy, and then I have cp -rp from new lappy to NC (after full Ubuntu Server & NC reinstall) and then occ scanned them into NC - and everything else I noted in my Joplin note.)

I’m getting close though, I feel it in my waters :rofl:

Was your old laptop dual boot & formatted to NTFS?

Would highly suggest exfat (rather than NTFS) on that laptop data partition. NTFS (laptop data) & Ext4 (server) will inevitably become an issue. It’s like electricity & water.

That’s all I’ve got for ya chap.


will look into exfat

I guess I could format the NC disk to NTFS too, maybe - I will investigate

Cheers for your thoughts!

After the Nextcloud sync has just gobbled up 75 GB of my work data I am now uploading the backup I made yesterday back to the lappy

And I will now be abandoning my attempts to get back to a real-time synced status between lappy and RPi Nextcloud.

It will now just be for the other things I use the RPi Nextcloud for and I might just sync manually via USB cable every so often to get my data up there - with Grsync and no way of deleting from my Lappy

Too scared it might gobble everything up otherwise.

I need a lie down after that scare

‘for posterity’ type thing:
I did abandon the Nextcloud client and now do the following, which I am far happier / more relaxed about:

  1. Every ‘n’ days, shutdown my Nextcloud RPi via SSH
  2. Take Nextcloud RPi external HDD and plug it into my lappy
  3. Use (g)rsync to sync my Nextcloud with my lappy files (Lappy is ‘Master’). NB: This has to be done as root as the HDD has to be chown root:root for Nextcloud to work
  4. Reconnect HDD to RPi and restart
  5. SSH into Nextcloud RPi and run the following to ‘index’ the changed files in Nextcloud:
 sudo nextcloud.occ files:scan --path="Leigh/files/HDD/Work"

which comes from:

sudo nextcloud.occ files:scan --path="<Nextcloud Username>/files/<External HDD name in Nextcloud>/<Directory name>"
1 Like