Nextcloud: cannot write/delete files on a usb drive [Solved]

Hi, sorry for my bad english.
I will try to write as clear as possible.

I installed nextcloud and all works fine (I’m waiting a public ip for enable letsencrypt for https), but when I mount ad usb drive, I can read all files but I cannot upload a new file inside or delete an existing file.
There is a solution for to do this?

Thanks to all and sorry for my bad english!


What file system format your USB drive has?

lsblk -o name,fstype,label,size,ro,type,mountpoint,partuuid,uuid

NAME        FSTYPE LABEL  SIZE RO TYPE MOUNTPOINT    PARTUUID                             UUID
sda                      14,4G  0 disk                                                    
└─sda1      vfat         14,4G  0 part /mnt/usbdrive                                      6F40-1BE4

Does the nextcloud user have permission to write on this folder?
ls -la /mnt/usbdrive

I think yes

root@DietPi:~# ls -la /mnt/usbdrive
totale 15396
drwxr-xr-x 6 root root   32768  1 gen  1970  .
drwxr-xr-x 7 root root    4096 22 ott 09.53  ..
-rwxr-xr-x 1 root root    4096 18 ott 15.46 '._medicina urgenza 9.docx'
-rwxr-xr-x 1 root root 5940094 18 ott 15.43 'medicina urgenza 9.docx'
-rwxr-xr-x 1 root root    4096 18 ott 15.46 '._med urgenza 10.docx'
-rwxr-xr-x 1 root root 4533210 18 ott 15.43 'med urgenza 10.docx'
-rwxr-xr-x 1 root root    4096 18 ott 15.46 '._med urgenza 12.docx'
-rwxr-xr-x 1 root root 4924574 18 ott 15.44 'med urgenza 12.docx'
drwxr-xr-x 4 root root   32768 18 lug  2019  .Spotlight-V100
drwxr-xr-x 2 root root   32768 13 ago  2020 'System Volume Information'
drwxr-xr-x 5 root root   32768 18 lug  2019  .Trash-1000
-rwxr-xr-x 1 root root    4096 18 lug  2019  ._.Trashes
drwxr-xr-x 3 root root   32768 18 lug  2019  .Trashes

I don’t think that nextcloud runs as root user.
ps -ef | grep -i nextcloud

root@DietPi:~# ps -ef | grep -i nextcloud
root      2404  2375  0 13:35 pts/0    00:00:00 grep -i nextcloud

Nextcloud is a web server application and not an own app. Therefore it is www-data user who needs the write permissions, as this is the one who execute the web server stack.

But I see it is vfat file system format. That would be a Windows file system and totally not recommended as vfat did not support Unix permissions at all. At least I recommend to use NTFS if really need. Best would be ext4

I try with ext4 but I’ve the same problem.

I tried

sudo chown -R www-data:www-data /mnt/usbdrive

but it returns me the error

operation not permitted


I format the drive with ext4 and I give this command

sudo chown -R www-data:www-data /mnt/usbdrive

and I resolve it!

Thank you to all!!!

Ok perfect. Good choice to use ext4 :wink: