How to allow a user totally control local web server?












0














I installed a local web-server (apache2, php5, mysql).
All the time I want to edit some permissions or to create a folder or to add some lines to hosts I need to login as a root.



Do I need to grant privileges by the root all the time for this folders and files or is there a way to make it at once? Maybe i should reinstall webserver by the user i want to use one?










share|improve this question



























    0














    I installed a local web-server (apache2, php5, mysql).
    All the time I want to edit some permissions or to create a folder or to add some lines to hosts I need to login as a root.



    Do I need to grant privileges by the root all the time for this folders and files or is there a way to make it at once? Maybe i should reinstall webserver by the user i want to use one?










    share|improve this question

























      0












      0








      0







      I installed a local web-server (apache2, php5, mysql).
      All the time I want to edit some permissions or to create a folder or to add some lines to hosts I need to login as a root.



      Do I need to grant privileges by the root all the time for this folders and files or is there a way to make it at once? Maybe i should reinstall webserver by the user i want to use one?










      share|improve this question













      I installed a local web-server (apache2, php5, mysql).
      All the time I want to edit some permissions or to create a folder or to add some lines to hosts I need to login as a root.



      Do I need to grant privileges by the root all the time for this folders and files or is there a way to make it at once? Maybe i should reinstall webserver by the user i want to use one?







      webserver






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jun 1 '12 at 13:27









      Rootical V.Rootical V.

      4252712




      4252712






















          2 Answers
          2






          active

          oldest

          votes


















          0














          You can do it by giving the file ownership to the user. Use chown command to do that.



          ex: chown -R user website_folder



          [-R is for recursively change file ownership; change user and the folder accordingly].



          And make sure you have write permission too. You can set write permission with chmod.



          ex: chmod +x webpage.html



          [The above command will give the write permission to the current user]






          share|improve this answer





















          • This means i have to do it every time i want to create a project.. Or if i change user to basic webserver folders i would not have to change it after?
            – Rootical V.
            Jun 1 '12 at 13:43












          • No, you can do chown -R user /var/www. it will change all permission. But don't change permissions of /etc/php5 (or any file in /etc/ ;). It is not a good practice.
            – Manula Waidyanatha
            Jun 1 '12 at 13:47





















          0














          Another option is add the user to the group used by the web server (and the group of the web files)



          usermod -aG www-apache $USER


          normally, the apache config files are write privileges to www-apache group (and the dir in /var/www)






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "89"
            };
            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: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            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%2faskubuntu.com%2fquestions%2f145058%2fhow-to-allow-a-user-totally-control-local-web-server%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            You can do it by giving the file ownership to the user. Use chown command to do that.



            ex: chown -R user website_folder



            [-R is for recursively change file ownership; change user and the folder accordingly].



            And make sure you have write permission too. You can set write permission with chmod.



            ex: chmod +x webpage.html



            [The above command will give the write permission to the current user]






            share|improve this answer





















            • This means i have to do it every time i want to create a project.. Or if i change user to basic webserver folders i would not have to change it after?
              – Rootical V.
              Jun 1 '12 at 13:43












            • No, you can do chown -R user /var/www. it will change all permission. But don't change permissions of /etc/php5 (or any file in /etc/ ;). It is not a good practice.
              – Manula Waidyanatha
              Jun 1 '12 at 13:47


















            0














            You can do it by giving the file ownership to the user. Use chown command to do that.



            ex: chown -R user website_folder



            [-R is for recursively change file ownership; change user and the folder accordingly].



            And make sure you have write permission too. You can set write permission with chmod.



            ex: chmod +x webpage.html



            [The above command will give the write permission to the current user]






            share|improve this answer





















            • This means i have to do it every time i want to create a project.. Or if i change user to basic webserver folders i would not have to change it after?
              – Rootical V.
              Jun 1 '12 at 13:43












            • No, you can do chown -R user /var/www. it will change all permission. But don't change permissions of /etc/php5 (or any file in /etc/ ;). It is not a good practice.
              – Manula Waidyanatha
              Jun 1 '12 at 13:47
















            0












            0








            0






            You can do it by giving the file ownership to the user. Use chown command to do that.



            ex: chown -R user website_folder



            [-R is for recursively change file ownership; change user and the folder accordingly].



            And make sure you have write permission too. You can set write permission with chmod.



            ex: chmod +x webpage.html



            [The above command will give the write permission to the current user]






            share|improve this answer












            You can do it by giving the file ownership to the user. Use chown command to do that.



            ex: chown -R user website_folder



            [-R is for recursively change file ownership; change user and the folder accordingly].



            And make sure you have write permission too. You can set write permission with chmod.



            ex: chmod +x webpage.html



            [The above command will give the write permission to the current user]







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jun 1 '12 at 13:42









            Manula WaidyanathaManula Waidyanatha

            6,05711619




            6,05711619












            • This means i have to do it every time i want to create a project.. Or if i change user to basic webserver folders i would not have to change it after?
              – Rootical V.
              Jun 1 '12 at 13:43












            • No, you can do chown -R user /var/www. it will change all permission. But don't change permissions of /etc/php5 (or any file in /etc/ ;). It is not a good practice.
              – Manula Waidyanatha
              Jun 1 '12 at 13:47




















            • This means i have to do it every time i want to create a project.. Or if i change user to basic webserver folders i would not have to change it after?
              – Rootical V.
              Jun 1 '12 at 13:43












            • No, you can do chown -R user /var/www. it will change all permission. But don't change permissions of /etc/php5 (or any file in /etc/ ;). It is not a good practice.
              – Manula Waidyanatha
              Jun 1 '12 at 13:47


















            This means i have to do it every time i want to create a project.. Or if i change user to basic webserver folders i would not have to change it after?
            – Rootical V.
            Jun 1 '12 at 13:43






            This means i have to do it every time i want to create a project.. Or if i change user to basic webserver folders i would not have to change it after?
            – Rootical V.
            Jun 1 '12 at 13:43














            No, you can do chown -R user /var/www. it will change all permission. But don't change permissions of /etc/php5 (or any file in /etc/ ;). It is not a good practice.
            – Manula Waidyanatha
            Jun 1 '12 at 13:47






            No, you can do chown -R user /var/www. it will change all permission. But don't change permissions of /etc/php5 (or any file in /etc/ ;). It is not a good practice.
            – Manula Waidyanatha
            Jun 1 '12 at 13:47















            0














            Another option is add the user to the group used by the web server (and the group of the web files)



            usermod -aG www-apache $USER


            normally, the apache config files are write privileges to www-apache group (and the dir in /var/www)






            share|improve this answer




























              0














              Another option is add the user to the group used by the web server (and the group of the web files)



              usermod -aG www-apache $USER


              normally, the apache config files are write privileges to www-apache group (and the dir in /var/www)






              share|improve this answer


























                0












                0








                0






                Another option is add the user to the group used by the web server (and the group of the web files)



                usermod -aG www-apache $USER


                normally, the apache config files are write privileges to www-apache group (and the dir in /var/www)






                share|improve this answer














                Another option is add the user to the group used by the web server (and the group of the web files)



                usermod -aG www-apache $USER


                normally, the apache config files are write privileges to www-apache group (and the dir in /var/www)







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Dec 17 '18 at 20:09









                SamFlynn

                5581721




                5581721










                answered Dec 17 '18 at 18:48









                Jesus Christian Cruz AconoJesus Christian Cruz Acono

                1




                1






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Ask Ubuntu!


                    • 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.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • 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%2faskubuntu.com%2fquestions%2f145058%2fhow-to-allow-a-user-totally-control-local-web-server%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

                    Quarter-circle Tiles

                    build a pushdown automaton that recognizes the reverse language of a given pushdown automaton?

                    Mont Emei