Guide for installing Owncloud 9 to Synology NAS running DSM 6

OwnCloud in Synology NAS

Owncloud is among the best things the open-source communities have produced. This guide will have detailed instructions for installing Owncloud 9 to Synology NAS device with DSM 6.

Some prewords:

  • At the time of this guide, DSM 6 is release candidate (rc) version
  • This is fresh install – no upgrade from existing owncloud version. If you are planning to do upgrade, please see my other blog post about Owncloud upgrade procedure and the things you should consider when doing the upgrade.
  • DSM 6 allows sudo to other users (root, http) in ssh terminal (with NAS admin password), it just makes many things easier (thanks Synology!)
  • I will be installing owncloud manually, so no synocommunity packages or install procedure is used
  • It is possible to install Redis server and php extension php-redis to your Synology NAS, in order to support file locking in owncloud. Please see my other blog post for installing phpredis into Synology NAS.
  • I’m assuming that you have enabled web station, SSH, installed PHP and Mariadb/phpMyAdmin and know what is Apache – in your Synology NAS. I’m also using scripts to automate permission assignments in SSH terminal sessions.
  • If you haven’t hosted any websites in your NAS earlier, please enable webstation package and test that PHP websites are working in your setup – through WAN 0r LAN, depending what are your plans on owncloud usage.  As minimum requirement use phpinfo() or similar PHP powered web page before jumping into Owncloud installation. This ensures you have your firewalls, web servers, virtual hosts etc. configured correctly.
  • My web root in this example is located in: /volume1/web/
    • If you have it in different location, please modify any scripts or examples given here accordingly.


Ok -let’s get started with the installation.

1)  Download the latest stable ZIP file from ( and copy extracted Owncloud folder to your Synology web root.

Download Owncloud server files

And here is the folder structure how it should look in ‘/web/owncloud/’:

kuva1c2)  Create empty owncloud data folder outside web folder, as recommended by Owncloud community  (I created it at: /volume1/owncloud/)

Note: If you decide to take this recommendation and setup your Owncloud data folder outside the web folder (makes upgrades, backups etc. easier) –  you have to make some additional configurations to your PHP settings in Synology admin UI. However – these changes are valid only if you want to access your Owncloud through Synology hosts from the WAN side.

There are 2 options to make the change required (otherwise php/Owncloud instance cannot access your data folder outside web folder):

Option a)

Append your PHP open_basedir configuration with the location of your Owncloud data folder (IF outside web folder):  ‘:/volume1/owncloud’

(Note: Do not delete any existing paths, add it to the end of the existing configuration – see screenshot)

Synology Admin UI -> Main Menu -> Web Station -> PHP Settings ->


If you choose option a – it is highly recommended in Owncloud hardening guide to update path [/dev/urandom] there also, see for the example in the provided screenshot above. Based on my personal experience, I’ve also disabled PHP cache here and I’m using Redis server for Owncloud caching.

OwnCloud uses a RFC 4086 (“Randomness Requirements for Security”) compliant mixer to generate cryptographically secure pseudo-random numbers. The random number generation also tries to request random numbers from /dev/urandom, thus it is highly recommended to configure your setup in such a way that PHP is able to read random data from it.

Option b)

Clear the whole open_basedir input box, and while keeping the customize option still checked, apply changes. This will disable global PHP open_basedir execution restrictions completely. You can still assign any site/host specific open_basedir restrictions using the .user.ini files approach in docroot folders for every host required.

This option b where open_basedir is disabled for Owncloud – is actually the recommended approach by Owncloud documentation if Owncloud is running in 32bit environment.

3)  Assign following permissions to folders for installation purposes. I run it using a script (.sh) file (remember to execute from system root!), with following contents:

Select Code

chown -R http:http /volume1/web/owncloud/
chown -R http:http /volume1/web/owncloud/apps/
chown -R http:http /volume1/web/owncloud/config/
chown -R http:http /volume1/web/owncloud/themes/
chown -R http:http /volume1/owncloud/

chown http:http /volume1/web/owncloud/.htaccess

find /volume1/web/owncloud/ -type f -print0 | xargs -0 chmod 777

find /volume1/web/owncloud/ -type d -print0 | xargs -0 chmod 777
find /volume1/owncloud/ -type d -print0 | xargs -0 chmod 777

chmod 777 /volume1/web/owncloud/.htaccess

And I’m running it in SSH terminal like this (run it as root as it “can be done in DSM 6″ and from root folder in SSH terminal):


4)  Enable Virtual host in NAS for the new owncloud folder in your web root.


I would highly recommend you choose Apache 2.2 as your webserver for your Owncloud virtual host. Mainly because it works out-of-the-box for most users in Owncloud / Synology NAS setup. Apache 2.4 has been reported not to work in recent comments received from users, and Nginx will require more configuration, especially the re-write rules might prove to be challenging (some users have reported 404 not found error after installation). So just choose Apache…!

5)  Double check that you know your Mariadb/MySQL root password – you will need it during owncloud setup/installation.

6)  Point your Web browser to the newly created Owncloud website/portal – and finalize installation. Please use the web address that you want to use when using Owncloud, so that during installation your domain will be automatically added to allowed domains in Owncloud config.php file. Please give Admin password and give other details.

Kuva47)  Give needed details for installing Owncloud. Highly recommended settings:

1.  That you use MySQL/MariaDB – give database details needed
2. Define your Owncloud DATA folder to be outside the Web folder for Owncloud

Kuva4c8)  After installation the Owncloud web interface should open.

Kuva5If you see the error “There were problems with the code integrity check” – this is most likely because Synology creates @eadir cache folders everywhere. Removing these manually from Owncloud folders will remove the error. In this job you might find this code useful:

Select Code
find . -name "@eaDir" -type d -print0 | xargs -0 rm -rf

And here is example on how to use it:

And you have now removed all ‘@eaDir’ folders from owncloud folders. And you should also be able to remove the error by Selecting ‘RESCAN’ on admin page of Owncloud.

kuva_remove_eadirs_check9)  After installation you need to assign more strict folder permissions back for Owncloud folders. Please regard the given script as example only – always validate security permissions for your needs as required – and review related documentation from for version 9.

I use a script (.sh) file, with following contents:

Select Code

chown -R root:http /volume1/web/owncloud/

chown -R http:http /volume1/web/owncloud/apps/
chown -R http:http /volume1/web/owncloud/config/
chown -R http:http /volume1/web/owncloud/themes/

chown root:http /volume1/web/owncloud/.htaccess
chown root:http /volume1/owncloud/.htaccess

find /volume1/web/owncloud/ -type f -print0 | xargs -0 chmod 0640
find /volume1/owncloud/ -type f -print0 | xargs -0 chmod 0640
find /volume1/web/owncloud/ -type d -print0 | xargs -0 chmod 0750
find /volume1/owncloud/ -type d -print0 | xargs -0 chmod 0750

chmod 0644 /volume1/web/owncloud/.htaccess
chmod 0644 /volume1/owncloud/.htaccess

And I’m running it in SSH terminal like this (run it as root as it “can be done in DSM 6″ and from root folder in SSH terminal):

Setup permissions for use

If you want to be able to edit the ‘max upload size’ section in Owncloud admin area, you might want to consider also having following permissions in place (upload size is overrided in hidden ‘.user.ini’ file in Owncloud root):

Select Code
chown http:http /volume1/web/owncloud/.user.ini

This makes the file writable by ‘http’ user, thus editable in Owncloud admin section.

10)  Double check that permissions got assigned correctly. You can also safely remove ‘data’ and ‘@eaDir’ folders inside ‘/web/owncloud/’ – they are not needed inside there if you created data folder outside the web folder as instructed:

Kuva811)  Done – You have successfully installed Owncloud 9 to your Synology NAS.

Owncloud running in Synology NASPlease follow closely and Owncloud Github for further configuration, setup and any other topical issues. There are million things still to configure in your Owncloud setup including config.php modifications etc. 

Note:  It is possible to install Redis server and php extension php-redis to your Synology NAS, in order to support Redis caching and file locking in owncloud. Please see my other blog post for installing phpredis into Synology NAS  running DSM6 without bootstrapping. Also I have posted a guide on how to configure Owncloud to use system CRON in Synology NAS (DSM 6 RC).

(update 28.3 2016 – cleaned permission scripts and made addition about PHP open_basedir config required if data folder outside Owncloud web folder)

(update 13.6 2016 – Updated Apache as the preferred webserver for the virtual host configuration in Synology NAS. Mainly because Apache works out-of-the-box. Nginx actually requires more configuration – especially the re-write rules may cause headache and 404 not found -errors.)

(update 14.2 2017 – Updated Apache 2.2 as the preferred webserver version for the virtual host configuration in Synology NAS, due to multiple users reporting issues when using Apache 2.4 with latest Owncloud and DSM versions.)


Juha Ketola

Juha Ketola

Author is a passionate IT enthusiast and early adopter. Packed with years of experience leading Enterprise level IT development teams within the biggest companies of Technology industry. Watches closely start-ups and new disruptive innovations in order to stay on the cutting edge. Embraces hands-on IT development and IoT.
Juha Ketola
Link to open Linkedin Profile

170 Responses to Guide for installing Owncloud 9 to Synology NAS running DSM 6

  1. Giovanni says:

    Very good explanation, I’ve done all and all seems to work except for one thing… smbclient
    I can configure after installed external storage support, some folder of my 2012server
    and even if all setting give me “all green” (ldap, and green button on external storage smb)
    when I log with an user (no matter if local or LDAP) it cannot connect to network share

    you know why?


    • Juha KetolaJuha Ketola says:


      Have you checked your firewall settings / log for the required ports? You need to allow from VPN IP range to required devices/services.

      One other explanation could be that you try the connection from behind company or other organization firewall / proxy.

      Good luck!

  2. Dylan says:

    Hi, Thanks you for the tutorial.

    I have a problem just after the point 7.

    now my send me à 403 error (forbidden) and i don’t understand why….

    • Juha KetolaJuha Ketola says:

      Hi Dylan,

      So the installation phase itself went successfully? But after install the owncloud UI won’t open?

      – Did you run successfully all those permission scripts when you followed guide?
      – Does HTTP user have the needed access to owncloud www folder?
      – Can PHP access your Owncloud data folder correctly?
      – Have you configured your virtual host correctly in your DSM UI? Are you using Apache web server?
      – Does your Owncloud config.php include listed all allowed domains for accessing Owncloud?

      Above is few things to get you started with the troubleshooting. You have some simple config issue in your permissions or www config now.

      • Dylan says:

        Hi, thank for the quick reply !

        “So the installation phase itself went successfully? But after install the owncloud UI won’t open? ”

        Exactly, i have been automaticly redirected on the 403 error after the installation. one personnal folder has been created in web.owncloud. index.html & .ocdata added too. .htaccess modified by the installation.

        I think i i find the problem. I forgot to check on the web station “Activate a personnal web site” so the WWW folder were not created. now i have this

        I added some permissions for http users in order to access (read only) the home folder

        Does im supposed to switch the index.html file created by owncloud after the installation located in web/owncloud/index.html ?

        Thank you for your help

      • Juha KetolaJuha Ketola says:


        Personal website folder for username has nothing to do with Owncloud, unless you really want to publish your owncloud under some specific username – which I doubt though.

        And no – you should not switch any index.html files in Owncloud directory. Do not touch those…

  3. Dylan says:

    Now it works fine thank you but the domain is only accessible from a computer on the same network than the NAS. Computer not from that network get a “Inacessible website” error.

    • Juha KetolaJuha Ketola says:


      I’m a bit puzzled on your comment. Please clarify your terms same network – different network? Are you talking about diff LAN ranges or WAN/LAN or what? Where are you having your DNS servers and domain name -> IP defined and hosted? How about your firewall rules? Is the domain name you use to access your Owncloud site defined in Ownclouds config.php? Is your NAS virtual host config matching your domain name config?

      Sorry – there are just too many possible solutions for your config problem….

  4. Ben Jones says:

    Firstly great tutorial, very easy to follow, even for a SSH newbie. but…

    ...lots of errors on the log

    Yes permissions updated successfully, yes sync working, yes trusted domains correct, yes using Apache webserver.

    Any help appreciated.


    • Ben Jones says:

      Hi Juha
      Just reinstalled it, as the script error-ed and the file permissions were not correct on install. Errors are gone now. After re-installing and makeing sure files and folders had 77 permissions.

      If i’m the only one using my NAS what are the risks of leaving file/folder permisisons at 777?


      • Juha KetolaJuha Ketola says:

        Hi Ben,

        Glad you sorted it out, was gonna propose you to doublecheck permissions on install after your first post….

        Please consider putting more strict permissions, it is always better in the long run. Try running each of the needed permission lines from the script individually in terminal, and please note you need to run those as root user, and from the entire system’s root directory. And you should be able to execute those without any errors, if you have modified paths for your install – modify commands accordingly.

        This is how to enter into the system root directory from where to execute the commands or the original scripts:

        cd /

        Take care.

  5. Joshuah Albert Navarro says:

    So I pointed to my web browser to my newly created owncloud and I get an empty white page.


    • Juha KetolaJuha Ketola says:


      See my response in other thread also, modify your config.php cache settings.
      This happens if the cache is not working as it should.

      And if you have the APCu enabled in config.php, and you do not have enabled/installed APCu in your server, this is what will happen.


      • Joshuah Albert Navarro says:

        yes, i am beginning to see I need to dedicate some time to this config file. There are a lot of options. I don’t believe I need all of them.

        Is there a post on how to begin with a barebones config file and add to it???

  6. Joshuah Albert Navarro says:

    Ok. So I got my barebones config file and I see some life in my OC installation.

    Very exciting stuff!!! To the server log.

  7. Joshuah Albert Navarro says:

    So, I am stuck at Internal Server error.
    Any clues where to go???

  8. Joshuah Albert Navarro says:

    Ok so good news. I figured out something I learned long ago. When nothing seems to work, take nothing out. So I renamed config.php file to konfigurationbeispiel.php (german) and let it rip.

    Yay. Now I got my install wizard.

    Gotta love this stuff!!!!

    • Juha KetolaJuha Ketola says:

      Hey Joshuah!

      It seems you’ve had some busy days there… Usually ppl are just rushing through the install without issues, so it really makes me wonder WHY an earth you’ve had so many challenges ## and now excluding your REDIS [- not =] issue ## 🙂

      The ONLY thing I can think of, is the fact that you installed REDIS before your Owncloud install. Usually it is done vice-versa. In practice you should first install Owncloud, let the install create the config needed, and only then modify the the config.php after successful install procedure. I believe that would have produced hassle free config for you as well.

      I would suggest taking a look at this link in Owncloud documentation, that goes through all the options in config.php: LINK

      Hope you figure all out, and get your instance running exactly as you want it.

      • Joshuah Albert Navarro says:

        That is just what I did. I like to look at it as practice purposes. HA!!! Thanks for such a great write up.

  9. NIcolas says:

    Hi Thanks for your guide,
    unfortunaly I don’t have a lot of experience with synology and webserver stuff.

    Since one week I try to install owncloud on my nas dsm6, but it is not working very well.

    If I set the webserver on apache I do get a 404 error trying to access the install page. If I set the webserver to Nginx I get the setup screen. But during the install process I get the message “Too many Redirects” and it breaks connection. No matter what browser I choose.

    I actually would like to use apache, but it seams like something is broken. Maybe it hase to do with open_basedir wich is now empty.

    If you need more infos, let me know.

    Thanks anyway for your help

    • Juha KetolaJuha Ketola says:


      What is your network config? Are you trying to do Owncloud install from WAN or LAN side? Is your virtual host configured to reflect correct domain name – please check? Are you using https, having re-directs some sort, enabled HSTS – these might easily break your setup if you have config issues? Have you disabled php cache in your Synology? If cache issue (or HSTS), try to clear browser cache or use private / incognito mode.

      Are you hosting any other websites on your Synology Apache? They working? I do state in the guide, that before Owncloud installation please host a php powered site (https if you plan to have https) and test that you can access it from desired network segment (for your Owncloud install).

      And open_basedir can be empty, as long as you keep the customize option ticked. This is how it has worked on Synology. But it is very easy to bring back defaults there, just remove the tick and apply, and then add there the needed owncloud folders (if you need those).

      • NIcolas says:

        Hi Juha,
        thanks for your answer,
        I’m installing from my LAN.
        What do you mean by “Is your virtual host configured to reflect correct domain name”? I set it to owncloud and the path ist /web/owncloud
        I’m not using https.
        HSTS is disabled
        PHP cash is disabled
        I’m using spymode and my browser cash is empty

        I’m not hosting other sites anymore, shall I install a wordpress site in the web root?

        Open_basedir is empty

        It is still not working 🙁

        Why can I access the install site if I set the webserver to Nginx instead of apache?

      • NIcolas says:

        just installed the wordpress pack on my ds and I get the same error 404 page can’t be found

      • Juha KetolaJuha Ketola says:

        Hi Nicolas,

        Ok. You have bigger issues than just Owncloud in your Synology. 🙁

        So you should forget about the Owncloud install now for a while, and focus in fixing your Apache configuration to serve web sites in general.

  10. NIcolas says:

    I installed the webstation beta version and now it is working. Unfortunaly only in my lan.

    What do I need to do to acess it from outside my lan? I do have a ddns but if I enter the adress is not working. is working fine 🙂

    Thanks for your support

  11. Alex says:


    looks like Option 2b (clearing th basedir) doesnt work anymore after upgrading to WebStation2. At least I had to bring the default path back and append the 2 additional pathes (like in 2a).
    Not sure if it is a bug, but Webstation 2 also doesnt bring you back the default string in the openbasedir, when unchecking the box.

    With Webstation 2 you could now use php7 and apache 2.4 for running owncloud. Any thoughts if this could improve the owncloud instance?

  12. Gregory says:

    Good evening,

    If i follow your process and everything seems to work fine.
    But when it comes to the end I always get an error message:

    Owncloud goes to the following site:

    the error message is the following:
    File not Found.
    Click here to go back to Owncloud

    I searched on so many sites without any solutions.
    Could you please give me a hint, because i dont know how to proceed.
    If you need any other informaitons, just ask.

    Many thanks.

Leave a Reply