How to `find` all files and folders with 0** permissions?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite
1












I had a strange situation where I've found a number of files and folders that had 000 permissions set. This was easily repairable via:



sudo find . -perm 000 -type f -exec chmod 664 ; 
sudo find . -perm 000 -type d -exec chmod 775 ;


Unfortunately I suddenly realized the problem was a bit more complicated with some odd permissions such as 044 and some other strange settings. It turns out that these are strewn about and unpredictable.



Is there a way to search for permissions such as 0** or other such very limiting permission configurations?







share|improve this question


























    up vote
    3
    down vote

    favorite
    1












    I had a strange situation where I've found a number of files and folders that had 000 permissions set. This was easily repairable via:



    sudo find . -perm 000 -type f -exec chmod 664 ; 
    sudo find . -perm 000 -type d -exec chmod 775 ;


    Unfortunately I suddenly realized the problem was a bit more complicated with some odd permissions such as 044 and some other strange settings. It turns out that these are strewn about and unpredictable.



    Is there a way to search for permissions such as 0** or other such very limiting permission configurations?







    share|improve this question
























      up vote
      3
      down vote

      favorite
      1









      up vote
      3
      down vote

      favorite
      1






      1





      I had a strange situation where I've found a number of files and folders that had 000 permissions set. This was easily repairable via:



      sudo find . -perm 000 -type f -exec chmod 664 ; 
      sudo find . -perm 000 -type d -exec chmod 775 ;


      Unfortunately I suddenly realized the problem was a bit more complicated with some odd permissions such as 044 and some other strange settings. It turns out that these are strewn about and unpredictable.



      Is there a way to search for permissions such as 0** or other such very limiting permission configurations?







      share|improve this question














      I had a strange situation where I've found a number of files and folders that had 000 permissions set. This was easily repairable via:



      sudo find . -perm 000 -type f -exec chmod 664 ; 
      sudo find . -perm 000 -type d -exec chmod 775 ;


      Unfortunately I suddenly realized the problem was a bit more complicated with some odd permissions such as 044 and some other strange settings. It turns out that these are strewn about and unpredictable.



      Is there a way to search for permissions such as 0** or other such very limiting permission configurations?









      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 27 at 13:42









      Stephen Kitt

      144k22312377




      144k22312377










      asked Aug 27 at 13:25









      ylluminate

      26117




      26117




















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          8
          down vote



          accepted










          I'd use something like this:



          find . ! -perm -u=r ! -perm -u=w ! -perm -u=x -ls


          Or if you prefer the octal notation:



          find . ! -perm -400 ! -perm -200 ! -perm -100 -ls


          Unfortunately, no idea, how to take it as one -perm option.



          That syntax above is standard except for the -ls part (common but not POSIX) which you can replace with -exec ls -disl + on systems where find doesn't support -ls to get a similar output.






          share|improve this answer






















          • @Stéphane Chazelas any arguments for use ! instead of -not ? IMHO it generates only problems in scripts, breaking pipes, needs to escape e.t.c.
            – Alexander
            Aug 27 at 14:00






          • 2




            -not is not standard, ! alone is never a problem, it's even the name of a POSIX shell keyword (!) and it's commonly used as argument to the [ / test command in addition to find.
            – Stéphane Chazelas
            Aug 27 at 14:01


















          up vote
          7
          down vote













          With GNU find, you can do this by looking for files which don’t match “any bit set for the owner”:



          find . ! -perm /700


          The same in e.g. FreeBSD find is



          find . ! -perm +700


          Both of these work in the same way. -perm /700 or -perm +700 match if any of the owner permission bits are set; ! negates that, so ! -perm /700 or ! -perm +700 match if none of the owner permission bits are set. The other bits are ignored.






          share|improve this answer






















          • Oh so the / operator inverts the bit of the first one? Ie, if I were looking for group instead would this be applied to the 2nd bit? Just curious now at this point to understand the permission functionality better. Also, just tried on macOS and got the following error when run interactively: find: -perm: /700: illegal mode string
            – ylluminate
            Aug 27 at 13:34







          • 1




            Ah, sorry, -perm / is a GNU extension which matches any of the given permission bits.
            – Stephen Kitt
            Aug 27 at 13:41










          • Thanks for clarifying, that would have been great and the answer had it worked for macOS' find.
            – ylluminate
            Aug 27 at 19:10










          • @ylluminate: To directly and more clearly answer your follow-up question (in the comment above): No, / doesn’t “invert” anything.  ! is the “NOT” operator, inverting the following test.   / is effectively an “OR” operator; find . ! -perm /700 is equivalent to find . ! "(" -perm -400 -o -perm -200 -o -perm -100 ")" — which is equivalent to find . ! -perm -400 ! -perm -200 ! -perm -100, which is directly equivalent to Alexander’s answer.  As Stephen said, / means “any of these bits”.
            – Scott
            Aug 27 at 21:35






          • 1




            @ylluminate, find . ! -perm +700 works with the find on Mac.
            – ilkkachu
            Aug 27 at 21:38

















          up vote
          1
          down vote













          If you use sfind or any program using libfind or if you use BSD find, you may use:



          find path -perm +0xxx


          to find files where any of the bits mentioned in the pattern are set, so



          find . ! -perm +0700


          should work in your case. BTW: this is also supported by GNU find.



          Note that this is an extension that is neither mentioned in POSIX nor implemented in a SVr4 based find.






          share|improve this answer




















          • Note that it was how GNU find (from 1991 to 2013, deprecated after 2005) used to do it as well, but they replaced it with -perm /0700 for POSIX compliance.
            – Stéphane Chazelas
            Aug 27 at 15:12










          • Since smake supports this feature using + and since I am very sure that smake is POSIX compliant, as it permits this special enhancement only in case that the + is followed by 0, u, g, o or a, I see no reason for this change.
            – schily
            Aug 27 at 15:20










          • find -perm +u is specified by POSIX (as being the same as -perm 0). It's not clear for -perm +0777, where +0777 could be considered as a non-negative octal number
            – Stéphane Chazelas
            Aug 27 at 15:45











          • Sorry, this is not in the POSIX standard. The plus sign is only specified after ugoa or before rwx and similar chars.
            – schily
            Aug 27 at 16:12











          • chmod +u is specified (gives all the same permission as the user, filtered by umask), so find -perm +u is as well. Also note how the find -perm spec makes it explicit that one can't use a perm that starts with - as it would conflict with -perm -mode, but there's no such thing for +.
            – Stéphane Chazelas
            Aug 27 at 16:16











          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          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',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f465081%2fhow-to-find-all-files-and-folders-with-0-permissions%23new-answer', 'question_page');

          );

          Post as a guest






























          3 Answers
          3






          active

          oldest

          votes








          3 Answers
          3






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          8
          down vote



          accepted










          I'd use something like this:



          find . ! -perm -u=r ! -perm -u=w ! -perm -u=x -ls


          Or if you prefer the octal notation:



          find . ! -perm -400 ! -perm -200 ! -perm -100 -ls


          Unfortunately, no idea, how to take it as one -perm option.



          That syntax above is standard except for the -ls part (common but not POSIX) which you can replace with -exec ls -disl + on systems where find doesn't support -ls to get a similar output.






          share|improve this answer






















          • @Stéphane Chazelas any arguments for use ! instead of -not ? IMHO it generates only problems in scripts, breaking pipes, needs to escape e.t.c.
            – Alexander
            Aug 27 at 14:00






          • 2




            -not is not standard, ! alone is never a problem, it's even the name of a POSIX shell keyword (!) and it's commonly used as argument to the [ / test command in addition to find.
            – Stéphane Chazelas
            Aug 27 at 14:01















          up vote
          8
          down vote



          accepted










          I'd use something like this:



          find . ! -perm -u=r ! -perm -u=w ! -perm -u=x -ls


          Or if you prefer the octal notation:



          find . ! -perm -400 ! -perm -200 ! -perm -100 -ls


          Unfortunately, no idea, how to take it as one -perm option.



          That syntax above is standard except for the -ls part (common but not POSIX) which you can replace with -exec ls -disl + on systems where find doesn't support -ls to get a similar output.






          share|improve this answer






















          • @Stéphane Chazelas any arguments for use ! instead of -not ? IMHO it generates only problems in scripts, breaking pipes, needs to escape e.t.c.
            – Alexander
            Aug 27 at 14:00






          • 2




            -not is not standard, ! alone is never a problem, it's even the name of a POSIX shell keyword (!) and it's commonly used as argument to the [ / test command in addition to find.
            – Stéphane Chazelas
            Aug 27 at 14:01













          up vote
          8
          down vote



          accepted







          up vote
          8
          down vote



          accepted






          I'd use something like this:



          find . ! -perm -u=r ! -perm -u=w ! -perm -u=x -ls


          Or if you prefer the octal notation:



          find . ! -perm -400 ! -perm -200 ! -perm -100 -ls


          Unfortunately, no idea, how to take it as one -perm option.



          That syntax above is standard except for the -ls part (common but not POSIX) which you can replace with -exec ls -disl + on systems where find doesn't support -ls to get a similar output.






          share|improve this answer














          I'd use something like this:



          find . ! -perm -u=r ! -perm -u=w ! -perm -u=x -ls


          Or if you prefer the octal notation:



          find . ! -perm -400 ! -perm -200 ! -perm -100 -ls


          Unfortunately, no idea, how to take it as one -perm option.



          That syntax above is standard except for the -ls part (common but not POSIX) which you can replace with -exec ls -disl + on systems where find doesn't support -ls to get a similar output.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Aug 27 at 21:57









          Stéphane Chazelas

          283k53521854




          283k53521854










          answered Aug 27 at 13:53









          Alexander

          65012




          65012











          • @Stéphane Chazelas any arguments for use ! instead of -not ? IMHO it generates only problems in scripts, breaking pipes, needs to escape e.t.c.
            – Alexander
            Aug 27 at 14:00






          • 2




            -not is not standard, ! alone is never a problem, it's even the name of a POSIX shell keyword (!) and it's commonly used as argument to the [ / test command in addition to find.
            – Stéphane Chazelas
            Aug 27 at 14:01

















          • @Stéphane Chazelas any arguments for use ! instead of -not ? IMHO it generates only problems in scripts, breaking pipes, needs to escape e.t.c.
            – Alexander
            Aug 27 at 14:00






          • 2




            -not is not standard, ! alone is never a problem, it's even the name of a POSIX shell keyword (!) and it's commonly used as argument to the [ / test command in addition to find.
            – Stéphane Chazelas
            Aug 27 at 14:01
















          @Stéphane Chazelas any arguments for use ! instead of -not ? IMHO it generates only problems in scripts, breaking pipes, needs to escape e.t.c.
          – Alexander
          Aug 27 at 14:00




          @Stéphane Chazelas any arguments for use ! instead of -not ? IMHO it generates only problems in scripts, breaking pipes, needs to escape e.t.c.
          – Alexander
          Aug 27 at 14:00




          2




          2




          -not is not standard, ! alone is never a problem, it's even the name of a POSIX shell keyword (!) and it's commonly used as argument to the [ / test command in addition to find.
          – Stéphane Chazelas
          Aug 27 at 14:01





          -not is not standard, ! alone is never a problem, it's even the name of a POSIX shell keyword (!) and it's commonly used as argument to the [ / test command in addition to find.
          – Stéphane Chazelas
          Aug 27 at 14:01













          up vote
          7
          down vote













          With GNU find, you can do this by looking for files which don’t match “any bit set for the owner”:



          find . ! -perm /700


          The same in e.g. FreeBSD find is



          find . ! -perm +700


          Both of these work in the same way. -perm /700 or -perm +700 match if any of the owner permission bits are set; ! negates that, so ! -perm /700 or ! -perm +700 match if none of the owner permission bits are set. The other bits are ignored.






          share|improve this answer






















          • Oh so the / operator inverts the bit of the first one? Ie, if I were looking for group instead would this be applied to the 2nd bit? Just curious now at this point to understand the permission functionality better. Also, just tried on macOS and got the following error when run interactively: find: -perm: /700: illegal mode string
            – ylluminate
            Aug 27 at 13:34







          • 1




            Ah, sorry, -perm / is a GNU extension which matches any of the given permission bits.
            – Stephen Kitt
            Aug 27 at 13:41










          • Thanks for clarifying, that would have been great and the answer had it worked for macOS' find.
            – ylluminate
            Aug 27 at 19:10










          • @ylluminate: To directly and more clearly answer your follow-up question (in the comment above): No, / doesn’t “invert” anything.  ! is the “NOT” operator, inverting the following test.   / is effectively an “OR” operator; find . ! -perm /700 is equivalent to find . ! "(" -perm -400 -o -perm -200 -o -perm -100 ")" — which is equivalent to find . ! -perm -400 ! -perm -200 ! -perm -100, which is directly equivalent to Alexander’s answer.  As Stephen said, / means “any of these bits”.
            – Scott
            Aug 27 at 21:35






          • 1




            @ylluminate, find . ! -perm +700 works with the find on Mac.
            – ilkkachu
            Aug 27 at 21:38














          up vote
          7
          down vote













          With GNU find, you can do this by looking for files which don’t match “any bit set for the owner”:



          find . ! -perm /700


          The same in e.g. FreeBSD find is



          find . ! -perm +700


          Both of these work in the same way. -perm /700 or -perm +700 match if any of the owner permission bits are set; ! negates that, so ! -perm /700 or ! -perm +700 match if none of the owner permission bits are set. The other bits are ignored.






          share|improve this answer






















          • Oh so the / operator inverts the bit of the first one? Ie, if I were looking for group instead would this be applied to the 2nd bit? Just curious now at this point to understand the permission functionality better. Also, just tried on macOS and got the following error when run interactively: find: -perm: /700: illegal mode string
            – ylluminate
            Aug 27 at 13:34







          • 1




            Ah, sorry, -perm / is a GNU extension which matches any of the given permission bits.
            – Stephen Kitt
            Aug 27 at 13:41










          • Thanks for clarifying, that would have been great and the answer had it worked for macOS' find.
            – ylluminate
            Aug 27 at 19:10










          • @ylluminate: To directly and more clearly answer your follow-up question (in the comment above): No, / doesn’t “invert” anything.  ! is the “NOT” operator, inverting the following test.   / is effectively an “OR” operator; find . ! -perm /700 is equivalent to find . ! "(" -perm -400 -o -perm -200 -o -perm -100 ")" — which is equivalent to find . ! -perm -400 ! -perm -200 ! -perm -100, which is directly equivalent to Alexander’s answer.  As Stephen said, / means “any of these bits”.
            – Scott
            Aug 27 at 21:35






          • 1




            @ylluminate, find . ! -perm +700 works with the find on Mac.
            – ilkkachu
            Aug 27 at 21:38












          up vote
          7
          down vote










          up vote
          7
          down vote









          With GNU find, you can do this by looking for files which don’t match “any bit set for the owner”:



          find . ! -perm /700


          The same in e.g. FreeBSD find is



          find . ! -perm +700


          Both of these work in the same way. -perm /700 or -perm +700 match if any of the owner permission bits are set; ! negates that, so ! -perm /700 or ! -perm +700 match if none of the owner permission bits are set. The other bits are ignored.






          share|improve this answer














          With GNU find, you can do this by looking for files which don’t match “any bit set for the owner”:



          find . ! -perm /700


          The same in e.g. FreeBSD find is



          find . ! -perm +700


          Both of these work in the same way. -perm /700 or -perm +700 match if any of the owner permission bits are set; ! negates that, so ! -perm /700 or ! -perm +700 match if none of the owner permission bits are set. The other bits are ignored.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Aug 28 at 6:56

























          answered Aug 27 at 13:29









          Stephen Kitt

          144k22312377




          144k22312377











          • Oh so the / operator inverts the bit of the first one? Ie, if I were looking for group instead would this be applied to the 2nd bit? Just curious now at this point to understand the permission functionality better. Also, just tried on macOS and got the following error when run interactively: find: -perm: /700: illegal mode string
            – ylluminate
            Aug 27 at 13:34







          • 1




            Ah, sorry, -perm / is a GNU extension which matches any of the given permission bits.
            – Stephen Kitt
            Aug 27 at 13:41










          • Thanks for clarifying, that would have been great and the answer had it worked for macOS' find.
            – ylluminate
            Aug 27 at 19:10










          • @ylluminate: To directly and more clearly answer your follow-up question (in the comment above): No, / doesn’t “invert” anything.  ! is the “NOT” operator, inverting the following test.   / is effectively an “OR” operator; find . ! -perm /700 is equivalent to find . ! "(" -perm -400 -o -perm -200 -o -perm -100 ")" — which is equivalent to find . ! -perm -400 ! -perm -200 ! -perm -100, which is directly equivalent to Alexander’s answer.  As Stephen said, / means “any of these bits”.
            – Scott
            Aug 27 at 21:35






          • 1




            @ylluminate, find . ! -perm +700 works with the find on Mac.
            – ilkkachu
            Aug 27 at 21:38
















          • Oh so the / operator inverts the bit of the first one? Ie, if I were looking for group instead would this be applied to the 2nd bit? Just curious now at this point to understand the permission functionality better. Also, just tried on macOS and got the following error when run interactively: find: -perm: /700: illegal mode string
            – ylluminate
            Aug 27 at 13:34







          • 1




            Ah, sorry, -perm / is a GNU extension which matches any of the given permission bits.
            – Stephen Kitt
            Aug 27 at 13:41










          • Thanks for clarifying, that would have been great and the answer had it worked for macOS' find.
            – ylluminate
            Aug 27 at 19:10










          • @ylluminate: To directly and more clearly answer your follow-up question (in the comment above): No, / doesn’t “invert” anything.  ! is the “NOT” operator, inverting the following test.   / is effectively an “OR” operator; find . ! -perm /700 is equivalent to find . ! "(" -perm -400 -o -perm -200 -o -perm -100 ")" — which is equivalent to find . ! -perm -400 ! -perm -200 ! -perm -100, which is directly equivalent to Alexander’s answer.  As Stephen said, / means “any of these bits”.
            – Scott
            Aug 27 at 21:35






          • 1




            @ylluminate, find . ! -perm +700 works with the find on Mac.
            – ilkkachu
            Aug 27 at 21:38















          Oh so the / operator inverts the bit of the first one? Ie, if I were looking for group instead would this be applied to the 2nd bit? Just curious now at this point to understand the permission functionality better. Also, just tried on macOS and got the following error when run interactively: find: -perm: /700: illegal mode string
          – ylluminate
          Aug 27 at 13:34





          Oh so the / operator inverts the bit of the first one? Ie, if I were looking for group instead would this be applied to the 2nd bit? Just curious now at this point to understand the permission functionality better. Also, just tried on macOS and got the following error when run interactively: find: -perm: /700: illegal mode string
          – ylluminate
          Aug 27 at 13:34





          1




          1




          Ah, sorry, -perm / is a GNU extension which matches any of the given permission bits.
          – Stephen Kitt
          Aug 27 at 13:41




          Ah, sorry, -perm / is a GNU extension which matches any of the given permission bits.
          – Stephen Kitt
          Aug 27 at 13:41












          Thanks for clarifying, that would have been great and the answer had it worked for macOS' find.
          – ylluminate
          Aug 27 at 19:10




          Thanks for clarifying, that would have been great and the answer had it worked for macOS' find.
          – ylluminate
          Aug 27 at 19:10












          @ylluminate: To directly and more clearly answer your follow-up question (in the comment above): No, / doesn’t “invert” anything.  ! is the “NOT” operator, inverting the following test.   / is effectively an “OR” operator; find . ! -perm /700 is equivalent to find . ! "(" -perm -400 -o -perm -200 -o -perm -100 ")" — which is equivalent to find . ! -perm -400 ! -perm -200 ! -perm -100, which is directly equivalent to Alexander’s answer.  As Stephen said, / means “any of these bits”.
          – Scott
          Aug 27 at 21:35




          @ylluminate: To directly and more clearly answer your follow-up question (in the comment above): No, / doesn’t “invert” anything.  ! is the “NOT” operator, inverting the following test.   / is effectively an “OR” operator; find . ! -perm /700 is equivalent to find . ! "(" -perm -400 -o -perm -200 -o -perm -100 ")" — which is equivalent to find . ! -perm -400 ! -perm -200 ! -perm -100, which is directly equivalent to Alexander’s answer.  As Stephen said, / means “any of these bits”.
          – Scott
          Aug 27 at 21:35




          1




          1




          @ylluminate, find . ! -perm +700 works with the find on Mac.
          – ilkkachu
          Aug 27 at 21:38




          @ylluminate, find . ! -perm +700 works with the find on Mac.
          – ilkkachu
          Aug 27 at 21:38










          up vote
          1
          down vote













          If you use sfind or any program using libfind or if you use BSD find, you may use:



          find path -perm +0xxx


          to find files where any of the bits mentioned in the pattern are set, so



          find . ! -perm +0700


          should work in your case. BTW: this is also supported by GNU find.



          Note that this is an extension that is neither mentioned in POSIX nor implemented in a SVr4 based find.






          share|improve this answer




















          • Note that it was how GNU find (from 1991 to 2013, deprecated after 2005) used to do it as well, but they replaced it with -perm /0700 for POSIX compliance.
            – Stéphane Chazelas
            Aug 27 at 15:12










          • Since smake supports this feature using + and since I am very sure that smake is POSIX compliant, as it permits this special enhancement only in case that the + is followed by 0, u, g, o or a, I see no reason for this change.
            – schily
            Aug 27 at 15:20










          • find -perm +u is specified by POSIX (as being the same as -perm 0). It's not clear for -perm +0777, where +0777 could be considered as a non-negative octal number
            – Stéphane Chazelas
            Aug 27 at 15:45











          • Sorry, this is not in the POSIX standard. The plus sign is only specified after ugoa or before rwx and similar chars.
            – schily
            Aug 27 at 16:12











          • chmod +u is specified (gives all the same permission as the user, filtered by umask), so find -perm +u is as well. Also note how the find -perm spec makes it explicit that one can't use a perm that starts with - as it would conflict with -perm -mode, but there's no such thing for +.
            – Stéphane Chazelas
            Aug 27 at 16:16















          up vote
          1
          down vote













          If you use sfind or any program using libfind or if you use BSD find, you may use:



          find path -perm +0xxx


          to find files where any of the bits mentioned in the pattern are set, so



          find . ! -perm +0700


          should work in your case. BTW: this is also supported by GNU find.



          Note that this is an extension that is neither mentioned in POSIX nor implemented in a SVr4 based find.






          share|improve this answer




















          • Note that it was how GNU find (from 1991 to 2013, deprecated after 2005) used to do it as well, but they replaced it with -perm /0700 for POSIX compliance.
            – Stéphane Chazelas
            Aug 27 at 15:12










          • Since smake supports this feature using + and since I am very sure that smake is POSIX compliant, as it permits this special enhancement only in case that the + is followed by 0, u, g, o or a, I see no reason for this change.
            – schily
            Aug 27 at 15:20










          • find -perm +u is specified by POSIX (as being the same as -perm 0). It's not clear for -perm +0777, where +0777 could be considered as a non-negative octal number
            – Stéphane Chazelas
            Aug 27 at 15:45











          • Sorry, this is not in the POSIX standard. The plus sign is only specified after ugoa or before rwx and similar chars.
            – schily
            Aug 27 at 16:12











          • chmod +u is specified (gives all the same permission as the user, filtered by umask), so find -perm +u is as well. Also note how the find -perm spec makes it explicit that one can't use a perm that starts with - as it would conflict with -perm -mode, but there's no such thing for +.
            – Stéphane Chazelas
            Aug 27 at 16:16













          up vote
          1
          down vote










          up vote
          1
          down vote









          If you use sfind or any program using libfind or if you use BSD find, you may use:



          find path -perm +0xxx


          to find files where any of the bits mentioned in the pattern are set, so



          find . ! -perm +0700


          should work in your case. BTW: this is also supported by GNU find.



          Note that this is an extension that is neither mentioned in POSIX nor implemented in a SVr4 based find.






          share|improve this answer












          If you use sfind or any program using libfind or if you use BSD find, you may use:



          find path -perm +0xxx


          to find files where any of the bits mentioned in the pattern are set, so



          find . ! -perm +0700


          should work in your case. BTW: this is also supported by GNU find.



          Note that this is an extension that is neither mentioned in POSIX nor implemented in a SVr4 based find.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Aug 27 at 14:11









          schily

          9,53831437




          9,53831437











          • Note that it was how GNU find (from 1991 to 2013, deprecated after 2005) used to do it as well, but they replaced it with -perm /0700 for POSIX compliance.
            – Stéphane Chazelas
            Aug 27 at 15:12










          • Since smake supports this feature using + and since I am very sure that smake is POSIX compliant, as it permits this special enhancement only in case that the + is followed by 0, u, g, o or a, I see no reason for this change.
            – schily
            Aug 27 at 15:20










          • find -perm +u is specified by POSIX (as being the same as -perm 0). It's not clear for -perm +0777, where +0777 could be considered as a non-negative octal number
            – Stéphane Chazelas
            Aug 27 at 15:45











          • Sorry, this is not in the POSIX standard. The plus sign is only specified after ugoa or before rwx and similar chars.
            – schily
            Aug 27 at 16:12











          • chmod +u is specified (gives all the same permission as the user, filtered by umask), so find -perm +u is as well. Also note how the find -perm spec makes it explicit that one can't use a perm that starts with - as it would conflict with -perm -mode, but there's no such thing for +.
            – Stéphane Chazelas
            Aug 27 at 16:16

















          • Note that it was how GNU find (from 1991 to 2013, deprecated after 2005) used to do it as well, but they replaced it with -perm /0700 for POSIX compliance.
            – Stéphane Chazelas
            Aug 27 at 15:12










          • Since smake supports this feature using + and since I am very sure that smake is POSIX compliant, as it permits this special enhancement only in case that the + is followed by 0, u, g, o or a, I see no reason for this change.
            – schily
            Aug 27 at 15:20










          • find -perm +u is specified by POSIX (as being the same as -perm 0). It's not clear for -perm +0777, where +0777 could be considered as a non-negative octal number
            – Stéphane Chazelas
            Aug 27 at 15:45











          • Sorry, this is not in the POSIX standard. The plus sign is only specified after ugoa or before rwx and similar chars.
            – schily
            Aug 27 at 16:12











          • chmod +u is specified (gives all the same permission as the user, filtered by umask), so find -perm +u is as well. Also note how the find -perm spec makes it explicit that one can't use a perm that starts with - as it would conflict with -perm -mode, but there's no such thing for +.
            – Stéphane Chazelas
            Aug 27 at 16:16
















          Note that it was how GNU find (from 1991 to 2013, deprecated after 2005) used to do it as well, but they replaced it with -perm /0700 for POSIX compliance.
          – Stéphane Chazelas
          Aug 27 at 15:12




          Note that it was how GNU find (from 1991 to 2013, deprecated after 2005) used to do it as well, but they replaced it with -perm /0700 for POSIX compliance.
          – Stéphane Chazelas
          Aug 27 at 15:12












          Since smake supports this feature using + and since I am very sure that smake is POSIX compliant, as it permits this special enhancement only in case that the + is followed by 0, u, g, o or a, I see no reason for this change.
          – schily
          Aug 27 at 15:20




          Since smake supports this feature using + and since I am very sure that smake is POSIX compliant, as it permits this special enhancement only in case that the + is followed by 0, u, g, o or a, I see no reason for this change.
          – schily
          Aug 27 at 15:20












          find -perm +u is specified by POSIX (as being the same as -perm 0). It's not clear for -perm +0777, where +0777 could be considered as a non-negative octal number
          – Stéphane Chazelas
          Aug 27 at 15:45





          find -perm +u is specified by POSIX (as being the same as -perm 0). It's not clear for -perm +0777, where +0777 could be considered as a non-negative octal number
          – Stéphane Chazelas
          Aug 27 at 15:45













          Sorry, this is not in the POSIX standard. The plus sign is only specified after ugoa or before rwx and similar chars.
          – schily
          Aug 27 at 16:12





          Sorry, this is not in the POSIX standard. The plus sign is only specified after ugoa or before rwx and similar chars.
          – schily
          Aug 27 at 16:12













          chmod +u is specified (gives all the same permission as the user, filtered by umask), so find -perm +u is as well. Also note how the find -perm spec makes it explicit that one can't use a perm that starts with - as it would conflict with -perm -mode, but there's no such thing for +.
          – Stéphane Chazelas
          Aug 27 at 16:16





          chmod +u is specified (gives all the same permission as the user, filtered by umask), so find -perm +u is as well. Also note how the find -perm spec makes it explicit that one can't use a perm that starts with - as it would conflict with -perm -mode, but there's no such thing for +.
          – Stéphane Chazelas
          Aug 27 at 16:16


















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f465081%2fhow-to-find-all-files-and-folders-with-0-permissions%23new-answer', 'question_page');

          );

          Post as a guest













































































          Comments

          Popular posts from this blog

          What does second last employer means? [closed]

          List of Gilmore Girls characters

          Confectionery