Magento 2: Permission issue with generated directory












0















I'm having issues installing a theme due to the 'generated' directory not generating all of the files that need to be generated after I run command:



php bin/magento setup:upgrade


Which I think is linked to permission issues (the generated directories have a default permission set to 775).



Because the generated folders are set to 775 permission, there is no 'write' permission for the other user (magento) and thus crashes instead of upgrading the new theme/modules.



I cannot run the command line as a root user as it uses cgi/fgi instead of cli. I end up having to run as the centos user which uses cli (magento's command line interface) If I could run cli commands as root user. I that would overcome the permission issues that prevents the 'generated' directory from generating all of the files and thus install modules and themes instead of throwing script errors.



I know magento 2.2.6 is relatively new and I'm probably facing an isolated issue given that the environment I'm running magento on is unique: aws instance with whm in the middle to provide greater flexibility and provide a cpanel interface.










share|improve this question

























  • This is exactly why Magento says you should setup Magento2 as a user on the server that has the correct group and permissions

    – Haim
    Nov 19 '18 at 5:04
















0















I'm having issues installing a theme due to the 'generated' directory not generating all of the files that need to be generated after I run command:



php bin/magento setup:upgrade


Which I think is linked to permission issues (the generated directories have a default permission set to 775).



Because the generated folders are set to 775 permission, there is no 'write' permission for the other user (magento) and thus crashes instead of upgrading the new theme/modules.



I cannot run the command line as a root user as it uses cgi/fgi instead of cli. I end up having to run as the centos user which uses cli (magento's command line interface) If I could run cli commands as root user. I that would overcome the permission issues that prevents the 'generated' directory from generating all of the files and thus install modules and themes instead of throwing script errors.



I know magento 2.2.6 is relatively new and I'm probably facing an isolated issue given that the environment I'm running magento on is unique: aws instance with whm in the middle to provide greater flexibility and provide a cpanel interface.










share|improve this question

























  • This is exactly why Magento says you should setup Magento2 as a user on the server that has the correct group and permissions

    – Haim
    Nov 19 '18 at 5:04














0












0








0








I'm having issues installing a theme due to the 'generated' directory not generating all of the files that need to be generated after I run command:



php bin/magento setup:upgrade


Which I think is linked to permission issues (the generated directories have a default permission set to 775).



Because the generated folders are set to 775 permission, there is no 'write' permission for the other user (magento) and thus crashes instead of upgrading the new theme/modules.



I cannot run the command line as a root user as it uses cgi/fgi instead of cli. I end up having to run as the centos user which uses cli (magento's command line interface) If I could run cli commands as root user. I that would overcome the permission issues that prevents the 'generated' directory from generating all of the files and thus install modules and themes instead of throwing script errors.



I know magento 2.2.6 is relatively new and I'm probably facing an isolated issue given that the environment I'm running magento on is unique: aws instance with whm in the middle to provide greater flexibility and provide a cpanel interface.










share|improve this question
















I'm having issues installing a theme due to the 'generated' directory not generating all of the files that need to be generated after I run command:



php bin/magento setup:upgrade


Which I think is linked to permission issues (the generated directories have a default permission set to 775).



Because the generated folders are set to 775 permission, there is no 'write' permission for the other user (magento) and thus crashes instead of upgrading the new theme/modules.



I cannot run the command line as a root user as it uses cgi/fgi instead of cli. I end up having to run as the centos user which uses cli (magento's command line interface) If I could run cli commands as root user. I that would overcome the permission issues that prevents the 'generated' directory from generating all of the files and thus install modules and themes instead of throwing script errors.



I know magento 2.2.6 is relatively new and I'm probably facing an isolated issue given that the environment I'm running magento on is unique: aws instance with whm in the middle to provide greater flexibility and provide a cpanel interface.







magento2 theme installation permissions aws






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 16 mins ago









Shoaib Munir

1,125521




1,125521










asked Nov 19 '18 at 4:32









user67295user67295

11




11













  • This is exactly why Magento says you should setup Magento2 as a user on the server that has the correct group and permissions

    – Haim
    Nov 19 '18 at 5:04



















  • This is exactly why Magento says you should setup Magento2 as a user on the server that has the correct group and permissions

    – Haim
    Nov 19 '18 at 5:04

















This is exactly why Magento says you should setup Magento2 as a user on the server that has the correct group and permissions

– Haim
Nov 19 '18 at 5:04





This is exactly why Magento says you should setup Magento2 as a user on the server that has the correct group and permissions

– Haim
Nov 19 '18 at 5:04










3 Answers
3






active

oldest

votes


















1














Magento 2 recommaded folder and file permission



Please follow folowing terminal commands for folder and file permission.



find . -type f -exec chmod 644 {} ;



find . -type d -exec chmod 755 {} ;



find var pub/static pub/media generated/ app/etc -type f -exec chmod g+w {} ;



find var pub/static pub/media generated/ app/etc -type d -exec chmod g+ws {} ;
chown -R : .



chmod u+x bin/magento



It worked like charm






share|improve this answer































    0














    Give 777 permission to 'generated' directory






    share|improve this answer































      0














      sudo chown -R $(whoami) YOUR_PROJECT_FOLDER && sudo chmod -R 777 YOUR_PROJECT_FOLDER






      share|improve this answer























        Your Answer








        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "479"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: false,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: null,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f250449%2fmagento-2-permission-issue-with-generated-directory%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        1














        Magento 2 recommaded folder and file permission



        Please follow folowing terminal commands for folder and file permission.



        find . -type f -exec chmod 644 {} ;



        find . -type d -exec chmod 755 {} ;



        find var pub/static pub/media generated/ app/etc -type f -exec chmod g+w {} ;



        find var pub/static pub/media generated/ app/etc -type d -exec chmod g+ws {} ;
        chown -R : .



        chmod u+x bin/magento



        It worked like charm






        share|improve this answer




























          1














          Magento 2 recommaded folder and file permission



          Please follow folowing terminal commands for folder and file permission.



          find . -type f -exec chmod 644 {} ;



          find . -type d -exec chmod 755 {} ;



          find var pub/static pub/media generated/ app/etc -type f -exec chmod g+w {} ;



          find var pub/static pub/media generated/ app/etc -type d -exec chmod g+ws {} ;
          chown -R : .



          chmod u+x bin/magento



          It worked like charm






          share|improve this answer


























            1












            1








            1







            Magento 2 recommaded folder and file permission



            Please follow folowing terminal commands for folder and file permission.



            find . -type f -exec chmod 644 {} ;



            find . -type d -exec chmod 755 {} ;



            find var pub/static pub/media generated/ app/etc -type f -exec chmod g+w {} ;



            find var pub/static pub/media generated/ app/etc -type d -exec chmod g+ws {} ;
            chown -R : .



            chmod u+x bin/magento



            It worked like charm






            share|improve this answer













            Magento 2 recommaded folder and file permission



            Please follow folowing terminal commands for folder and file permission.



            find . -type f -exec chmod 644 {} ;



            find . -type d -exec chmod 755 {} ;



            find var pub/static pub/media generated/ app/etc -type f -exec chmod g+w {} ;



            find var pub/static pub/media generated/ app/etc -type d -exec chmod g+ws {} ;
            chown -R : .



            chmod u+x bin/magento



            It worked like charm







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 21 '18 at 7:20









            ARUNPRABAKARAN MARUNPRABAKARAN M

            5210




            5210

























                0














                Give 777 permission to 'generated' directory






                share|improve this answer




























                  0














                  Give 777 permission to 'generated' directory






                  share|improve this answer


























                    0












                    0








                    0







                    Give 777 permission to 'generated' directory






                    share|improve this answer













                    Give 777 permission to 'generated' directory







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 19 '18 at 5:06









                    Raju SadadiyaRaju Sadadiya

                    1612




                    1612























                        0














                        sudo chown -R $(whoami) YOUR_PROJECT_FOLDER && sudo chmod -R 777 YOUR_PROJECT_FOLDER






                        share|improve this answer




























                          0














                          sudo chown -R $(whoami) YOUR_PROJECT_FOLDER && sudo chmod -R 777 YOUR_PROJECT_FOLDER






                          share|improve this answer


























                            0












                            0








                            0







                            sudo chown -R $(whoami) YOUR_PROJECT_FOLDER && sudo chmod -R 777 YOUR_PROJECT_FOLDER






                            share|improve this answer













                            sudo chown -R $(whoami) YOUR_PROJECT_FOLDER && sudo chmod -R 777 YOUR_PROJECT_FOLDER







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Nov 19 '18 at 10:32









                            Kharidas ChebotaryovKharidas Chebotaryov

                            286




                            286






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Magento Stack Exchange!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f250449%2fmagento-2-permission-issue-with-generated-directory%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                What other Star Trek series did the main TNG cast show up in?

                                Berlina muro

                                Berlina aerponto