OK so here is how i configure OwnCloud to manage my FreeNAS datas (my aim is to access them from outside my network through OwnCloud)
Here is my setup :
- FreeNAS-9.2.1.9 to share data on my network to different Users (smb/nfs/...)
- I have only one dataset.
- In my dataset I use folders to sort my datas. One folder for Medias, one for Downloads and the last one for Personal Documents (each user will have his own folder in this folder).
Before beginning I want you to know that I'm not a FreeNAS or OwnCloud expert. My solution is probably not the more secure or safe for your data so if you follow my instructions, you do it at your own risk.
Now that you are warned let's begin.
First, be sure that OwnCloud plugin is correctly installed and that the first user has already been created
In order that OwnCloud manages your data, the user "www" must have rwx permissions on desired files and folders
In my case I created a new group called "data". In this group I added the user "www" and all the users who have to access the OC shared datas in rwx permissions.
Now this group must be the "owner group" for files and folders you want that OwnCloud manages.
You can use the -R option to apply recursively the chgrp command to a folder :
#chgrp -R <group> <file or folder path>
in my case : #chgrp -R data MEDIAS
Add the rwx permission to the owner group, again use the -R option to apply recursively the chmod command.
#chmod -R <permission code> <file or folder path>
eg. : #chmod -R 775 MEDIA
Now the permissions are correct go to the Jail shell (Jails -> View Jails -> <Select owncloud_1> -> Shell Button) and add the "data" group with the same GID as in FreeNAS :
#pw groupadd <group name> -g <Desired Group ID>
eg. : #pw groupadd data -g 1200
Then let's add Storage to the Jail. Create a folder in the Jail (eg. "medias") and set the "owner group" to data :
#cd /media/<username>/files/
#mkdir medias
#chgrp data medias
#chmod 775 medias
Config the new jail storage in FreeNAS WebUI (Jails -> Owncloud_1 ->Storage -> Add Storage).
First select your desired FreeNAS Storage. Then select the folder you've juste created in the jail.
Last step, tell OwnCloud to scan for new content.
In the the Jail shell :
#cd /usr/pbi/owncloud-amd64/bin/
#./php ../www/owncloud/console.php files:scan --all
Rem : PHP is not a default command in the Jail so we have to launch it from the bin folder (or add php as default command)
This should be done each time you add a folder in the OC User Root folder (/media/<OC User>/)