I have got myself into a bit of a pickle managing a magento site for a new business venture. I am pretty out of my depth and am very much a beginner in command line and server management. I have a cloud centos 6 server, with a magento 2 site.

  • The site was came installed as part of the initial set up (under user root)
  • I have subsequently used command line as user root (bad I know, but not sure of exactly what the correct thing is) to run cron, clear cache, run indexes, run any upgrades

I now have a few issues that occur intermittently - I get an SQL error and have to restart SQL, it takes the entire site down, front and backend - I get a permissions error on varying files which brings down the front and backend of the sites - The cron stops working due to permissions issues (and could potentially then cause the SQL error?)

In order to get around the issue with permissions I have been doing something terrible setting all files to 777, just because I don't know what the right thing to do is.

I have been reading loads of resources online to try to know exactly what the right thing to do is, but I believe none are entirely suited to my requirements. I think what I need to do is the following:

Log in as root user (I have no other) Set up a new user 'magento_user' Assign to nginx group Restart nginx Set owner of files in magento root and on to be the magento_user (not sure how to do this) Reset permissions on the all the files and folders to follow correct privileges (as the magento user or root?) Set cron for Magento to run (as root or magento_user?)

Does this sound correct, if anyone can . offer me some guidance I would really appreciate it.

Also when I have had issues previous I have had to run magento upgrade (among other commands to refresh things and clear errors). I should do this as magento_user not root I am guessing?

Is there any other glaring poor choice things you can tell me I shouldn't be doing as root? I am fairly sure I have been doing all the wrong things!

Thanks in advance,


  • The owner group should be same for all folders.
    – Gagan
    Jun 25 '18 at 12:45
  • 1
    Better you should explain the issue you are facing. This is soemthing that can help you - devdocs.magento.com/guides/v2.0/install-gde/prereq/nginx.html
    – Gagan
    Jun 25 '18 at 12:48
  • Thanks LAW. I can see that the majority of folders within magento directory are owned by root but some are owned by nginx as well. I will look at that documentation now.
    – Ella SG
    Jun 26 '18 at 14:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.