OwnCloud setup with external Network Drive

Having issues with your DietPi installation, or, found a bug? Post it here.
Post Reply
dpsguard
Posts: 45
Joined: Mon Aug 03, 2020 12:48 am

OwnCloud setup with external Network Drive

Post by dpsguard »

I am trying to first time install owncloud on my RPi running latest version of DietPi. So this works if I opt for default data folder of /var/www/owncloud/data.

However as everyone else will like to do, I am trying owncloud to use external drive for data storage. I thought this will be simple. Using dietpi drive manager, I have mounted my network drive to /mnt/samba and then set this up as external drive under owncloud app, providing the private IP, username / password, directory to use on it and it shows up as green on the owncloud app admin / storage.

But it does not show up under client. So I then thought to change the data path right at the initial set up wizard. I then went into /var/www/owncloud/config and deleted the config.php. Then I went back to http://PrivateIPofRPi/owncloud and I get the same wizard back in. At this time, I supply again the username / password (that I created initially), data folder as /mnt/samba/, database user as root, password whatever I had created under mariadb secure setup, DB name etc and hit finish setup. But I get the error:

Can't create or write into the data directory /mnt/samba/

So clearly this is permission issues. I manually tried to set these permissions using:

chown -R www-data:www-data /mnt/samba/
chmod -R 775 /mnt/samba/

restarted and I still get the same error.

I then ran this script which is supposed to fix such issues, but again I have the same error.

https://doc.owncloud.org/server/10.5/ad ... ermissions

Am I doing something wrong here? Any help will be appreciated.
User avatar
Joulinar
Posts: 2572
Joined: Sat Nov 16, 2019 12:49 am

Re: OwnCloud setup with external Network Drive

Post by Joulinar »

Hi,

many thanks for your message. Best to my knowledge a samba share did not support UNIX file system permissions. I guess /mnt/samba/ is still owned by user dietpi and not by www-data. Pls can you check this. If yes you would have 2 options. Add user www-data into use group dietpi . Or you are going to adjust /etc/fstab to have the directory mounted as user www-data. But there is a risk that drive manage will overwrite /etc/fstab once called again.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
dpsguard
Posts: 45
Joined: Mon Aug 03, 2020 12:48 am

Re: OwnCloud setup with external Network Drive

Post by dpsguard »

Thank you as always @Joulinar for your excellent support.

I added www-data to dietpi group.

adduser www-data dietpi

groups www-data
www-data : www-data dietpi pihole


samba as you rightly said is owned by dietpi. Adding www-data to dietpi group has not resolved the error.

:~# ls -al /mnt/
total 20
drwxrwxr-x 6 www-data www-data 4096 Oct 19 13:20 .
drwxr-xr-x 21 root root 4096 Jun 8 06:05 ..
drwxrwxr-x 7 www-data www-data 4096 Oct 19 12:40 dietpi_userdata
drwxrwxr-x 2 www-data www-data 4096 Jun 8 06:05 ftp_client
drwxrwxr-x 2 www-data www-data 4096 Jun 8 06:05 nfs_client
drwxrwx--- 2 dietpi dietpi 0 Oct 19 16:58 samba
:~#
User avatar
Joulinar
Posts: 2572
Joined: Sat Nov 16, 2019 12:49 am

Re: OwnCloud setup with external Network Drive

Post by Joulinar »

could you try following. This will check on OS level if user www-data is able to write to /mnt/samba/

Code: Select all

sudo -u www-data touch /mnt/samba/test.file
and did you do a reboot?
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
dpsguard
Posts: 45
Joined: Mon Aug 03, 2020 12:48 am

Re: OwnCloud setup with external Network Drive

Post by dpsguard »

Somehow I have messed it up now. After changing permissions, mysql broke down. I tried to reinstall / uninstall, but I keep getting the errors and mysql / mariadb service is not starting. I will reinstall tomorrow and then try again and then let you know. Thank you again and stay well.
User avatar
Joulinar
Posts: 2572
Joined: Sat Nov 16, 2019 12:49 am

Re: OwnCloud setup with external Network Drive

Post by Joulinar »

I don't think there is a need to play around with permissons on file system level. You just need to place www-data in dietpi group. I testes it yesterday and I got access for user www-data on a samba share

Code: Select all

usermod -a -G examplegroup exampleusername
means in your case

Code: Select all

usermod -a -G dietpi www-data
afterwards following should be working

Code: Select all

sudo -u www-data touch /mnt/samba/test.file
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Post Reply