Not knowing if this is a client or Nextcloud installation problem, but suspecting the latter, I have posted here
I am setting up the Nextcloud Ubuntu Appliance on my RPi3 Nextcloud Box which has an external hard disk.
I have my data on the RPi external disk (I connected it to my PC and copied it over then scanned using sudo nextcloud.occ files:scan when back on the RPi) and I can access the files on the external disk via nextcloud.local
I then synced with the data on my Manjaro OS PC using the client (version 3.03 (Manjaro)), but if I put a new file on the PC the client returns an error 403 Forbidden to PUT ⌠(Sabre\DAV\Exception\Forbidden) and the file is not transferred (although the client gives me a tick to say all synced correctly)
I have already, via ssh, run sudo snap connect nextcloud:removable-media core:removable-media which I thought would give the Snap permissions, and I can access the files on the external disk via nextcloud.local
Syncing between my PC and a folder on the RPi SD card itself works no problems, so I guess its some problem with the permissions of the external hard disk on the RPi
I automatically mount the external disk as per here
I can not make a new file or folder (could not create âŚ)
EDIT:
The above is true within the main folders that I copied to my RPI hard disk from my PC
However, if I move to the âroot directoryâ of the external disk in the Web interface I can upload and make new files and folders
Before I read your post, I had just looked at the permissions:
(i) Disk root: drwxrwxrwx 6 leigh root
(ii) Both main folders on Disk: drwxr-xr-x 22 leigh leigh
Since it worked for the disk root (permissions 777) but not the main folders (permissions 755) I simply ran sudo chmod -R 777 for both folders, and it all worked
However, I was just about to post asking if my setting full rights to everyone was a dumb thing to do (even though I am the only one using it)
Now I have seen your post I think maybe yes it was dumb
So, to do what you suggested, for both folders I did: sudo chown -R www-data:www-data /path-of-each-external-folder-in-turn
Nextcloud is running as (confined) root, not www-data, so @Mageunicâs suggestion is better written as:
$ sudo chown -R root:root /path-of-storage
Despite your being the only user here, itâs best practice to not use 777 for permissions unless you explicitly desire that functionality. I suspect you need no more than 700 for directories and 600 for files, but 750 across the board is probably okay.
Its the bumbling along, not really knowing what Iâm doing but learning along the way that I find most fun, thatâs why doing it all again is no problem
Although running sudo chown -R root:root /media/usb & sudo chmod -R 750 /media/usb/ gave me access to the files, the client would not sync and Nextcloud repeatedly stopped so I redid the transfer of the files to my external disk etc:
First, I
Deleted the external disk âexternal storageâ on the Web Interface
Deleted the Folder Sync connections in the Client
Physically connected the external disk to my laptop with a USB cable,
Deleted my files from the external disk,
Then I:
Re-transferred my files over to the external disk from my laptop NB making sure to use cp -rp so that then the desktop client worked properly and didnât flag up false changes
Re-ran sudo nextcloud.occ files:scan --path="<Nextcloud user_id>/files/<name given to disk in Nextcloud>/<Directory of interest on external disk>"
Ran sudo chown -R root:root /media/usb
Re-added the external disk as an external storage
Re-added the Folder Sync connections in the Client
And now everything is working fine (fingers crossed!)
[ I did not need to run sudo chmod -R 750 /media/usb/]