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

Having issues with your DietPi installation or found a bug? Post it here.
archytino
Posts: 6
Joined: Fri Oct 22, 2021 10:01 am

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

Post by archytino »

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!
Last edited by archytino on Sat Oct 23, 2021 11:45 am, edited 3 times in total.
User avatar
Joulinar
Posts: 6525
Joined: Sat Nov 16, 2019 12:49 am

Re: Nextcloud: cannot write/delete files on a usb drive

Post by Joulinar »

Hi,

What file system format your USB drive has?

Code: Select all

lsblk -o name,fstype,label,size,ro,type,mountpoint,partuuid,uuid
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
archytino
Posts: 6
Joined: Fri Oct 22, 2021 10:01 am

Re: Nextcloud: cannot write/delete files on a usb drive

Post by archytino »

Joulinar wrote: Fri Oct 22, 2021 11:15 am Hi,

What file system format your USB drive has?

Code: Select all

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

Code: Select all

NAME        FSTYPE LABEL  SIZE RO TYPE MOUNTPOINT    PARTUUID                             UUID
sda                      14,4G  0 disk                                                    
└─sda1      vfat         14,4G  0 part /mnt/usbdrive                                      6F40-1BE4
User avatar
trendy
Posts: 397
Joined: Tue Feb 25, 2020 2:54 pm

Re: Nextcloud: cannot write/delete files on a usb drive

Post by trendy »

Does the nextcloud user have permission to write on this folder?
ls -la /mnt/usbdrive
archytino
Posts: 6
Joined: Fri Oct 22, 2021 10:01 am

Re: Nextcloud: cannot write/delete files on a usb drive

Post by archytino »

trendy wrote: Fri Oct 22, 2021 12:10 pm Does the nextcloud user have permission to write on this folder?
ls -la /mnt/usbdrive
I think yes

Code: Select all

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
User avatar
trendy
Posts: 397
Joined: Tue Feb 25, 2020 2:54 pm

Re: Nextcloud: cannot write/delete files on a usb drive

Post by trendy »

I don't think that nextcloud runs as root user.
ps -ef | grep -i nextcloud
archytino
Posts: 6
Joined: Fri Oct 22, 2021 10:01 am

Re: Nextcloud: cannot write/delete files on a usb drive

Post by archytino »

trendy wrote: Fri Oct 22, 2021 1:31 pm I don't think that nextcloud runs as root user.
ps -ef | grep -i nextcloud

Code: Select all

root@DietPi:~# ps -ef | grep -i nextcloud
root      2404  2375  0 13:35 pts/0    00:00:00 grep -i nextcloud
User avatar
Joulinar
Posts: 6525
Joined: Sat Nov 16, 2019 12:49 am

Re: Nextcloud: cannot write/delete files on a usb drive

Post by Joulinar »

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
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
archytino
Posts: 6
Joined: Fri Oct 22, 2021 10:01 am

Re: Nextcloud: cannot write/delete files on a usb drive

Post by archytino »

Joulinar wrote: Fri Oct 22, 2021 3:10 pm 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.
archytino
Posts: 6
Joined: Fri Oct 22, 2021 10:01 am

Re: Nextcloud: cannot write/delete files on a usb drive

Post by archytino »

I tried

Code: Select all

sudo chown -R www-data:www-data /mnt/usbdrive
but it returns me the error

Code: Select all

operation not permitted

Edit:

I format the drive with ext4 and I give this command

Code: Select all

sudo chown -R www-data:www-data /mnt/usbdrive
and I resolve it!

Thank you to all!!!!
Post Reply