How to use wilcards on chown command?












0















I need to use wildcards on chown command. Example:



# chown app:demo /opt/app/users/*/demo


I get the following error:



chown: can not access "/opt/app/users/*/demo" ': No such file or directory


But does not work. What can I do?










share|improve this question

























  • Have you permission? Maybe you nedd to use sudo

    – jcbermu
    Mar 15 '16 at 14:14













  • use centos 6 and root user.

    – e-info128
    Mar 15 '16 at 14:16






  • 2





    Remove the double quotes on the directory path chown storage:storage_clientes_bitac -R /home/storage/storage/Empresa/*/Bitacoras

    – jcbermu
    Mar 15 '16 at 14:16


















0















I need to use wildcards on chown command. Example:



# chown app:demo /opt/app/users/*/demo


I get the following error:



chown: can not access "/opt/app/users/*/demo" ': No such file or directory


But does not work. What can I do?










share|improve this question

























  • Have you permission? Maybe you nedd to use sudo

    – jcbermu
    Mar 15 '16 at 14:14













  • use centos 6 and root user.

    – e-info128
    Mar 15 '16 at 14:16






  • 2





    Remove the double quotes on the directory path chown storage:storage_clientes_bitac -R /home/storage/storage/Empresa/*/Bitacoras

    – jcbermu
    Mar 15 '16 at 14:16
















0












0








0








I need to use wildcards on chown command. Example:



# chown app:demo /opt/app/users/*/demo


I get the following error:



chown: can not access "/opt/app/users/*/demo" ': No such file or directory


But does not work. What can I do?










share|improve this question
















I need to use wildcards on chown command. Example:



# chown app:demo /opt/app/users/*/demo


I get the following error:



chown: can not access "/opt/app/users/*/demo" ': No such file or directory


But does not work. What can I do?







bash chown






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 18 at 15:32









Henders

10326




10326










asked Mar 15 '16 at 13:51









e-info128e-info128

1066




1066













  • Have you permission? Maybe you nedd to use sudo

    – jcbermu
    Mar 15 '16 at 14:14













  • use centos 6 and root user.

    – e-info128
    Mar 15 '16 at 14:16






  • 2





    Remove the double quotes on the directory path chown storage:storage_clientes_bitac -R /home/storage/storage/Empresa/*/Bitacoras

    – jcbermu
    Mar 15 '16 at 14:16





















  • Have you permission? Maybe you nedd to use sudo

    – jcbermu
    Mar 15 '16 at 14:14













  • use centos 6 and root user.

    – e-info128
    Mar 15 '16 at 14:16






  • 2





    Remove the double quotes on the directory path chown storage:storage_clientes_bitac -R /home/storage/storage/Empresa/*/Bitacoras

    – jcbermu
    Mar 15 '16 at 14:16



















Have you permission? Maybe you nedd to use sudo

– jcbermu
Mar 15 '16 at 14:14







Have you permission? Maybe you nedd to use sudo

– jcbermu
Mar 15 '16 at 14:14















use centos 6 and root user.

– e-info128
Mar 15 '16 at 14:16





use centos 6 and root user.

– e-info128
Mar 15 '16 at 14:16




2




2





Remove the double quotes on the directory path chown storage:storage_clientes_bitac -R /home/storage/storage/Empresa/*/Bitacoras

– jcbermu
Mar 15 '16 at 14:16







Remove the double quotes on the directory path chown storage:storage_clientes_bitac -R /home/storage/storage/Empresa/*/Bitacoras

– jcbermu
Mar 15 '16 at 14:16












2 Answers
2






active

oldest

votes


















1














You have enclosed your pattern in "double quotes", which prevent filename expansion (also called globbing):




Double quotes: "..." prevents some substitutions but allows others. Every substitution that begins with a dollar sign $ is performed, as is the legacy ... (backtick) command substitution. Backslash escaping is also performed. No word splitting or filename expansion is performed.




The solution is obviously to run your command without the quotes, like jcbermu pointed out:



chown storage:storage_clientes_bitac -R /home/storage/storage/Empresa/*/Bitacoras





One important thing you should remember is to post commands and error messages verbatim when asking questions. Not everyone here likes guessing games.




share|improve this answer































    0














    Wildcards are often problematic when not in the basename



    You could do this



    find /opt/app/users/ -name demo -exec chown app:demo {} ;





    share|improve this answer
























    • need /opt/app/users/*/demo/ but no /opt/app/users/*/demo2/demo

      – e-info128
      Mar 15 '16 at 14:24











    • Oh, just one layer deep? try find /opt/app/users/ -maxdepth 1 -type d -name demo -exec echo {} found; to see if that works. If it finds the right directories, change the echo into a chown command

      – infixed
      Mar 15 '16 at 14:35













    • I'm not where I can try it. Maybe it's -maxdepth 2 you need.

      – infixed
      Mar 15 '16 at 14:42











    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "3"
    };
    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%2fsuperuser.com%2fquestions%2f1053124%2fhow-to-use-wilcards-on-chown-command%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









    1














    You have enclosed your pattern in "double quotes", which prevent filename expansion (also called globbing):




    Double quotes: "..." prevents some substitutions but allows others. Every substitution that begins with a dollar sign $ is performed, as is the legacy ... (backtick) command substitution. Backslash escaping is also performed. No word splitting or filename expansion is performed.




    The solution is obviously to run your command without the quotes, like jcbermu pointed out:



    chown storage:storage_clientes_bitac -R /home/storage/storage/Empresa/*/Bitacoras





    One important thing you should remember is to post commands and error messages verbatim when asking questions. Not everyone here likes guessing games.




    share|improve this answer




























      1














      You have enclosed your pattern in "double quotes", which prevent filename expansion (also called globbing):




      Double quotes: "..." prevents some substitutions but allows others. Every substitution that begins with a dollar sign $ is performed, as is the legacy ... (backtick) command substitution. Backslash escaping is also performed. No word splitting or filename expansion is performed.




      The solution is obviously to run your command without the quotes, like jcbermu pointed out:



      chown storage:storage_clientes_bitac -R /home/storage/storage/Empresa/*/Bitacoras





      One important thing you should remember is to post commands and error messages verbatim when asking questions. Not everyone here likes guessing games.




      share|improve this answer


























        1












        1








        1







        You have enclosed your pattern in "double quotes", which prevent filename expansion (also called globbing):




        Double quotes: "..." prevents some substitutions but allows others. Every substitution that begins with a dollar sign $ is performed, as is the legacy ... (backtick) command substitution. Backslash escaping is also performed. No word splitting or filename expansion is performed.




        The solution is obviously to run your command without the quotes, like jcbermu pointed out:



        chown storage:storage_clientes_bitac -R /home/storage/storage/Empresa/*/Bitacoras





        One important thing you should remember is to post commands and error messages verbatim when asking questions. Not everyone here likes guessing games.




        share|improve this answer













        You have enclosed your pattern in "double quotes", which prevent filename expansion (also called globbing):




        Double quotes: "..." prevents some substitutions but allows others. Every substitution that begins with a dollar sign $ is performed, as is the legacy ... (backtick) command substitution. Backslash escaping is also performed. No word splitting or filename expansion is performed.




        The solution is obviously to run your command without the quotes, like jcbermu pointed out:



        chown storage:storage_clientes_bitac -R /home/storage/storage/Empresa/*/Bitacoras





        One important thing you should remember is to post commands and error messages verbatim when asking questions. Not everyone here likes guessing games.





        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 21 '16 at 16:48









        Dmitry GrigoryevDmitry Grigoryev

        5,92212259




        5,92212259

























            0














            Wildcards are often problematic when not in the basename



            You could do this



            find /opt/app/users/ -name demo -exec chown app:demo {} ;





            share|improve this answer
























            • need /opt/app/users/*/demo/ but no /opt/app/users/*/demo2/demo

              – e-info128
              Mar 15 '16 at 14:24











            • Oh, just one layer deep? try find /opt/app/users/ -maxdepth 1 -type d -name demo -exec echo {} found; to see if that works. If it finds the right directories, change the echo into a chown command

              – infixed
              Mar 15 '16 at 14:35













            • I'm not where I can try it. Maybe it's -maxdepth 2 you need.

              – infixed
              Mar 15 '16 at 14:42
















            0














            Wildcards are often problematic when not in the basename



            You could do this



            find /opt/app/users/ -name demo -exec chown app:demo {} ;





            share|improve this answer
























            • need /opt/app/users/*/demo/ but no /opt/app/users/*/demo2/demo

              – e-info128
              Mar 15 '16 at 14:24











            • Oh, just one layer deep? try find /opt/app/users/ -maxdepth 1 -type d -name demo -exec echo {} found; to see if that works. If it finds the right directories, change the echo into a chown command

              – infixed
              Mar 15 '16 at 14:35













            • I'm not where I can try it. Maybe it's -maxdepth 2 you need.

              – infixed
              Mar 15 '16 at 14:42














            0












            0








            0







            Wildcards are often problematic when not in the basename



            You could do this



            find /opt/app/users/ -name demo -exec chown app:demo {} ;





            share|improve this answer













            Wildcards are often problematic when not in the basename



            You could do this



            find /opt/app/users/ -name demo -exec chown app:demo {} ;






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 15 '16 at 14:16









            infixedinfixed

            72949




            72949













            • need /opt/app/users/*/demo/ but no /opt/app/users/*/demo2/demo

              – e-info128
              Mar 15 '16 at 14:24











            • Oh, just one layer deep? try find /opt/app/users/ -maxdepth 1 -type d -name demo -exec echo {} found; to see if that works. If it finds the right directories, change the echo into a chown command

              – infixed
              Mar 15 '16 at 14:35













            • I'm not where I can try it. Maybe it's -maxdepth 2 you need.

              – infixed
              Mar 15 '16 at 14:42



















            • need /opt/app/users/*/demo/ but no /opt/app/users/*/demo2/demo

              – e-info128
              Mar 15 '16 at 14:24











            • Oh, just one layer deep? try find /opt/app/users/ -maxdepth 1 -type d -name demo -exec echo {} found; to see if that works. If it finds the right directories, change the echo into a chown command

              – infixed
              Mar 15 '16 at 14:35













            • I'm not where I can try it. Maybe it's -maxdepth 2 you need.

              – infixed
              Mar 15 '16 at 14:42

















            need /opt/app/users/*/demo/ but no /opt/app/users/*/demo2/demo

            – e-info128
            Mar 15 '16 at 14:24





            need /opt/app/users/*/demo/ but no /opt/app/users/*/demo2/demo

            – e-info128
            Mar 15 '16 at 14:24













            Oh, just one layer deep? try find /opt/app/users/ -maxdepth 1 -type d -name demo -exec echo {} found; to see if that works. If it finds the right directories, change the echo into a chown command

            – infixed
            Mar 15 '16 at 14:35







            Oh, just one layer deep? try find /opt/app/users/ -maxdepth 1 -type d -name demo -exec echo {} found; to see if that works. If it finds the right directories, change the echo into a chown command

            – infixed
            Mar 15 '16 at 14:35















            I'm not where I can try it. Maybe it's -maxdepth 2 you need.

            – infixed
            Mar 15 '16 at 14:42





            I'm not where I can try it. Maybe it's -maxdepth 2 you need.

            – infixed
            Mar 15 '16 at 14:42


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Super User!


            • 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%2fsuperuser.com%2fquestions%2f1053124%2fhow-to-use-wilcards-on-chown-command%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

            Index of /

            Tribalistas

            Listed building