how set read and write permissions for a directory Announcing the arrival of Valued Associate...

Flash light on something

Would it be easier to apply for a UK visa if there is a host family to sponsor for you in going there?

How would a mousetrap for use in space work?

Can a Beast Master ranger change beast companions?

What is the meaning of 'breadth' in breadth first search?

Draw 4 of the same figure in the same tikzpicture

Does the Mueller report show a conspiracy between Russia and the Trump Campaign?

Did any compiler fully use 80-bit floating point?

Drawing spherical mirrors

Deconstruction is ambiguous

How can I set the aperture on my DSLR when it's attached to a telescope instead of a lens?

How does light 'choose' between wave and particle behaviour?

How much damage would a cupful of neutron star matter do to the Earth?

Getting prompted for verification code but where do I put it in?

Lagrange four-squares theorem --- deterministic complexity

What does 丫 mean? 丫是什么意思?

The Nth Gryphon Number

How many time has Arya actually used Needle?

Why can't I install Tomboy in Ubuntu Mate 19.04?

Intuitive explanation of the rank-nullity theorem

A letter with no particular backstory

How does the math work when buying airline miles?

Why does it sometimes sound good to play a grace note as a lead in to a note in a melody?

The test team as an enemy of development? And how can this be avoided?



how set read and write permissions for a directory



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)How can I change a set of files Permsissions from Root to userDefault filesystem permissions and access rights in 12.04?Allowing a group Read-Write Access to a directoryPermissions problems with /var/www/html and my own home directory for a website document rootHow do I change owner to current user on folder and containing folders inside my home directory?folders and files permissions please helpSpecial directory permissions for new userunable to set constant permissions for web filesSetting Independant Permissions for Directories and FilesHow to change 'group' permission to read and write





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















I just copied a 2.8 Gb folder to my usr/home directory using Nautilus. It contains many folders and files but I have permission to read none of them. How can I globally set read & write & execute permissions for myself.



I have one user account & the root account on my computer. However I don't want to do everything as root.










share|improve this question














bumped to the homepage by Community 1 hour ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • The two answers so far (and I suspect others in the future) say to "chown -R ...". One should almost never do that without also specifying the "-h" option too. Especially if one is doing this as root for another user (which isn't the case in this question). Without the "-h", when chown encounters a symbolic link, it changes the ownership of the target of the link, which is almost never what is wanted (e.g. suppose there is a symlink to /etc/shadow).

    – Ray Butterworth
    1 hour ago


















0















I just copied a 2.8 Gb folder to my usr/home directory using Nautilus. It contains many folders and files but I have permission to read none of them. How can I globally set read & write & execute permissions for myself.



I have one user account & the root account on my computer. However I don't want to do everything as root.










share|improve this question














bumped to the homepage by Community 1 hour ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • The two answers so far (and I suspect others in the future) say to "chown -R ...". One should almost never do that without also specifying the "-h" option too. Especially if one is doing this as root for another user (which isn't the case in this question). Without the "-h", when chown encounters a symbolic link, it changes the ownership of the target of the link, which is almost never what is wanted (e.g. suppose there is a symlink to /etc/shadow).

    – Ray Butterworth
    1 hour ago














0












0








0








I just copied a 2.8 Gb folder to my usr/home directory using Nautilus. It contains many folders and files but I have permission to read none of them. How can I globally set read & write & execute permissions for myself.



I have one user account & the root account on my computer. However I don't want to do everything as root.










share|improve this question














I just copied a 2.8 Gb folder to my usr/home directory using Nautilus. It contains many folders and files but I have permission to read none of them. How can I globally set read & write & execute permissions for myself.



I have one user account & the root account on my computer. However I don't want to do everything as root.







permissions






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 9 '18 at 22:37









Nicholas BourbakiNicholas Bourbaki

1111




1111





bumped to the homepage by Community 1 hour ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 1 hour ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • The two answers so far (and I suspect others in the future) say to "chown -R ...". One should almost never do that without also specifying the "-h" option too. Especially if one is doing this as root for another user (which isn't the case in this question). Without the "-h", when chown encounters a symbolic link, it changes the ownership of the target of the link, which is almost never what is wanted (e.g. suppose there is a symlink to /etc/shadow).

    – Ray Butterworth
    1 hour ago



















  • The two answers so far (and I suspect others in the future) say to "chown -R ...". One should almost never do that without also specifying the "-h" option too. Especially if one is doing this as root for another user (which isn't the case in this question). Without the "-h", when chown encounters a symbolic link, it changes the ownership of the target of the link, which is almost never what is wanted (e.g. suppose there is a symlink to /etc/shadow).

    – Ray Butterworth
    1 hour ago

















The two answers so far (and I suspect others in the future) say to "chown -R ...". One should almost never do that without also specifying the "-h" option too. Especially if one is doing this as root for another user (which isn't the case in this question). Without the "-h", when chown encounters a symbolic link, it changes the ownership of the target of the link, which is almost never what is wanted (e.g. suppose there is a symlink to /etc/shadow).

– Ray Butterworth
1 hour ago





The two answers so far (and I suspect others in the future) say to "chown -R ...". One should almost never do that without also specifying the "-h" option too. Especially if one is doing this as root for another user (which isn't the case in this question). Without the "-h", when chown encounters a symbolic link, it changes the ownership of the target of the link, which is almost never what is wanted (e.g. suppose there is a symlink to /etc/shadow).

– Ray Butterworth
1 hour ago










2 Answers
2






active

oldest

votes


















0














sudo chown -R username <folderpath>
sudo chmod -R 644 <folderpath>


Explanation:



chown makes the username the owner of the folder (-R does it recursively)
chmod changes all the permissions to be read and write for the users. It's an optional step. You can skip it if you know the permissions to be correct and/or have executable files inside the folder with +x set.






share|improve this answer



















  • 1





    chmod -R 644 removes execute permission from directories - which will make everything below <folderpath> inaccessible

    – steeldriver
    Mar 9 '18 at 23:17



















0














First change the ownership:



sudo chown -R username: <directory>


(the : after the username means in fact the user default group, so it resets the group too at the same time)



Now you do not need sudo anymore you can operate under your normal user account.



First get yourself read and write access to all content:



chmod -R u=rw,go=r <directory>


Which means Read and Write access for User (the user owning the files, so that is you), but only Read for Group and Other. The = means to set the right, whatever it is now, you can also use + and - to respectively add or remove the given permission.



You can prefer:



chmod -R ug=rw,o=r <directory>


or even:



chmod -R ug=rw,o= <directory>


And the result should be clear from the explanation above (I do not know why people absolutely continue to use octal encoding to do the same thing, it has no superior value, but anyway if needed, Read is 4, Write is 2 and eXecute is 1, and you have to add the values. So my last example would be 660)



There is only one remaining step. You need to put the eXecute right on each directory and subdirectory otherwise cd will not work.



For that you can do:



find directory -type d | xargs chmod u+x


The find command like it says will find, starting at directory every object that is of type d, d meaning directory here, and the xargs command will apply the following (chmod u+x) on all of them, and based on the previous explanations, the u+x part should be straightforward.



Also, next time, if you start the copy directly under your username, the permissions should be ok from the beginning. If not it means you may have strange permissions on the top directory where you do the copy.






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%2f1013528%2fhow-set-read-and-write-permissions-for-a-directory%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














    sudo chown -R username <folderpath>
    sudo chmod -R 644 <folderpath>


    Explanation:



    chown makes the username the owner of the folder (-R does it recursively)
    chmod changes all the permissions to be read and write for the users. It's an optional step. You can skip it if you know the permissions to be correct and/or have executable files inside the folder with +x set.






    share|improve this answer



















    • 1





      chmod -R 644 removes execute permission from directories - which will make everything below <folderpath> inaccessible

      – steeldriver
      Mar 9 '18 at 23:17
















    0














    sudo chown -R username <folderpath>
    sudo chmod -R 644 <folderpath>


    Explanation:



    chown makes the username the owner of the folder (-R does it recursively)
    chmod changes all the permissions to be read and write for the users. It's an optional step. You can skip it if you know the permissions to be correct and/or have executable files inside the folder with +x set.






    share|improve this answer



















    • 1





      chmod -R 644 removes execute permission from directories - which will make everything below <folderpath> inaccessible

      – steeldriver
      Mar 9 '18 at 23:17














    0












    0








    0







    sudo chown -R username <folderpath>
    sudo chmod -R 644 <folderpath>


    Explanation:



    chown makes the username the owner of the folder (-R does it recursively)
    chmod changes all the permissions to be read and write for the users. It's an optional step. You can skip it if you know the permissions to be correct and/or have executable files inside the folder with +x set.






    share|improve this answer













    sudo chown -R username <folderpath>
    sudo chmod -R 644 <folderpath>


    Explanation:



    chown makes the username the owner of the folder (-R does it recursively)
    chmod changes all the permissions to be read and write for the users. It's an optional step. You can skip it if you know the permissions to be correct and/or have executable files inside the folder with +x set.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Mar 9 '18 at 22:38









    Adnan YAdnan Y

    1012




    1012








    • 1





      chmod -R 644 removes execute permission from directories - which will make everything below <folderpath> inaccessible

      – steeldriver
      Mar 9 '18 at 23:17














    • 1





      chmod -R 644 removes execute permission from directories - which will make everything below <folderpath> inaccessible

      – steeldriver
      Mar 9 '18 at 23:17








    1




    1





    chmod -R 644 removes execute permission from directories - which will make everything below <folderpath> inaccessible

    – steeldriver
    Mar 9 '18 at 23:17





    chmod -R 644 removes execute permission from directories - which will make everything below <folderpath> inaccessible

    – steeldriver
    Mar 9 '18 at 23:17













    0














    First change the ownership:



    sudo chown -R username: <directory>


    (the : after the username means in fact the user default group, so it resets the group too at the same time)



    Now you do not need sudo anymore you can operate under your normal user account.



    First get yourself read and write access to all content:



    chmod -R u=rw,go=r <directory>


    Which means Read and Write access for User (the user owning the files, so that is you), but only Read for Group and Other. The = means to set the right, whatever it is now, you can also use + and - to respectively add or remove the given permission.



    You can prefer:



    chmod -R ug=rw,o=r <directory>


    or even:



    chmod -R ug=rw,o= <directory>


    And the result should be clear from the explanation above (I do not know why people absolutely continue to use octal encoding to do the same thing, it has no superior value, but anyway if needed, Read is 4, Write is 2 and eXecute is 1, and you have to add the values. So my last example would be 660)



    There is only one remaining step. You need to put the eXecute right on each directory and subdirectory otherwise cd will not work.



    For that you can do:



    find directory -type d | xargs chmod u+x


    The find command like it says will find, starting at directory every object that is of type d, d meaning directory here, and the xargs command will apply the following (chmod u+x) on all of them, and based on the previous explanations, the u+x part should be straightforward.



    Also, next time, if you start the copy directly under your username, the permissions should be ok from the beginning. If not it means you may have strange permissions on the top directory where you do the copy.






    share|improve this answer




























      0














      First change the ownership:



      sudo chown -R username: <directory>


      (the : after the username means in fact the user default group, so it resets the group too at the same time)



      Now you do not need sudo anymore you can operate under your normal user account.



      First get yourself read and write access to all content:



      chmod -R u=rw,go=r <directory>


      Which means Read and Write access for User (the user owning the files, so that is you), but only Read for Group and Other. The = means to set the right, whatever it is now, you can also use + and - to respectively add or remove the given permission.



      You can prefer:



      chmod -R ug=rw,o=r <directory>


      or even:



      chmod -R ug=rw,o= <directory>


      And the result should be clear from the explanation above (I do not know why people absolutely continue to use octal encoding to do the same thing, it has no superior value, but anyway if needed, Read is 4, Write is 2 and eXecute is 1, and you have to add the values. So my last example would be 660)



      There is only one remaining step. You need to put the eXecute right on each directory and subdirectory otherwise cd will not work.



      For that you can do:



      find directory -type d | xargs chmod u+x


      The find command like it says will find, starting at directory every object that is of type d, d meaning directory here, and the xargs command will apply the following (chmod u+x) on all of them, and based on the previous explanations, the u+x part should be straightforward.



      Also, next time, if you start the copy directly under your username, the permissions should be ok from the beginning. If not it means you may have strange permissions on the top directory where you do the copy.






      share|improve this answer


























        0












        0








        0







        First change the ownership:



        sudo chown -R username: <directory>


        (the : after the username means in fact the user default group, so it resets the group too at the same time)



        Now you do not need sudo anymore you can operate under your normal user account.



        First get yourself read and write access to all content:



        chmod -R u=rw,go=r <directory>


        Which means Read and Write access for User (the user owning the files, so that is you), but only Read for Group and Other. The = means to set the right, whatever it is now, you can also use + and - to respectively add or remove the given permission.



        You can prefer:



        chmod -R ug=rw,o=r <directory>


        or even:



        chmod -R ug=rw,o= <directory>


        And the result should be clear from the explanation above (I do not know why people absolutely continue to use octal encoding to do the same thing, it has no superior value, but anyway if needed, Read is 4, Write is 2 and eXecute is 1, and you have to add the values. So my last example would be 660)



        There is only one remaining step. You need to put the eXecute right on each directory and subdirectory otherwise cd will not work.



        For that you can do:



        find directory -type d | xargs chmod u+x


        The find command like it says will find, starting at directory every object that is of type d, d meaning directory here, and the xargs command will apply the following (chmod u+x) on all of them, and based on the previous explanations, the u+x part should be straightforward.



        Also, next time, if you start the copy directly under your username, the permissions should be ok from the beginning. If not it means you may have strange permissions on the top directory where you do the copy.






        share|improve this answer













        First change the ownership:



        sudo chown -R username: <directory>


        (the : after the username means in fact the user default group, so it resets the group too at the same time)



        Now you do not need sudo anymore you can operate under your normal user account.



        First get yourself read and write access to all content:



        chmod -R u=rw,go=r <directory>


        Which means Read and Write access for User (the user owning the files, so that is you), but only Read for Group and Other. The = means to set the right, whatever it is now, you can also use + and - to respectively add or remove the given permission.



        You can prefer:



        chmod -R ug=rw,o=r <directory>


        or even:



        chmod -R ug=rw,o= <directory>


        And the result should be clear from the explanation above (I do not know why people absolutely continue to use octal encoding to do the same thing, it has no superior value, but anyway if needed, Read is 4, Write is 2 and eXecute is 1, and you have to add the values. So my last example would be 660)



        There is only one remaining step. You need to put the eXecute right on each directory and subdirectory otherwise cd will not work.



        For that you can do:



        find directory -type d | xargs chmod u+x


        The find command like it says will find, starting at directory every object that is of type d, d meaning directory here, and the xargs command will apply the following (chmod u+x) on all of them, and based on the previous explanations, the u+x part should be straightforward.



        Also, next time, if you start the copy directly under your username, the permissions should be ok from the beginning. If not it means you may have strange permissions on the top directory where you do the copy.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 9 '18 at 23:19









        Patrick MevzekPatrick Mevzek

        2761212




        2761212






























            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.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1013528%2fhow-set-read-and-write-permissions-for-a-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

            Why do type traits not work with types in namespace scope?What are POD types in C++?Why can templates only be...

            Will tsunami waves travel forever if there was no land?Why do tsunami waves begin with the water flowing away...

            Simple Scan not detecting my scanner (Brother DCP-7055W)Brother MFC-L2700DW printer can print, can't...