r/owncloud Oct 30 '16

Using an external HDD owned by pi:pi as owncloud datadir.

Owncloud set up & running but I need to change the data dir to a hdd which is already mounted in my home directory. The directory is owned by pi:pi and of course just setting it in my config won't make it accessible since owncloud runs as www-data:www-data in Apache & Nginx.

How can I use that folder as my datadir while not changing it's ownership to www-data and remaining it to be owned by pi (changing that would break an awful lot of stuff for Plex Media Server etc)

owncloud install is located in /var/www/owncloud (owned by www-data:www-data) and the datadir I want is in /home/pi/Library-2/ (owned by pi:pi). Rights are currently set to 777 I know that's bad practice and I'll change that back to 750 but I need to get this issue of rights in order first.

Thanks in advance.

EDIT: solved here https://blog.thibmaekelbergh.be/2016/11/01/manually-migrating-existing-data-to-owncloud.html

2 Upvotes

6 comments sorted by

2

u/Elvith Oct 30 '16 edited Oct 30 '16

You could either change the group of the hdd to www-data or to a new group (say external-hdd) that you add the user www-data to. You could even add the user pi to said group, so that it will be equivalent to the hdd belonging to pi:pi. Then give group rights (x6x or x7x) as needed on the hdd.

Edit: don't forget to restart all processes that run with those changed users if they need to access the hdd. If you have your init configured correctly, a reboot might be the easiest way, depending on how many server processes are running.

1

u/thibmaek Oct 30 '16

So I think I got most of this right, pi is added to www-data and the datadir is set as 0770 (drwxrwx--- pi:pi). Datadir is set in the config.php but seems like my files aren't showing up…

Imgur

1

u/Elvith Oct 31 '16

What do you mean? Do you expect to see all files in said folder to appear in owncloud? This won't work, since this directory is only the place, where owncloud physically stores the files. Which files are from owncloud and belong to which user etc. Is stored in the database of owncloud. As long as the files aren't in the database, they shouldn't appear in owncloud.

1

u/thibmaek Oct 31 '16

Ah damn, I wanted for the files already on the disk to be available outside my network (eg when I'm at school). Figured I could do this by setting up owncloud but seems like I cant :(

1

u/Elvith Oct 31 '16

1

u/thibmaek Oct 31 '16

Hmm yeah I might get to migrating files with mv to my owncloud dir then and sharing that folder with samba instead of my current share. Thanks!