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

Clash Royale CLAN TAG#URR8PPP
up vote
3
down vote
favorite
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?
shell permissions find osx
add a comment |Â
up vote
3
down vote
favorite
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?
shell permissions find osx
add a comment |Â
up vote
3
down vote
favorite
up vote
3
down vote
favorite
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?
shell permissions find osx
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?
shell permissions find osx
edited Aug 27 at 13:42
Stephen Kitt
144k22312377
144k22312377
asked Aug 27 at 13:25
ylluminate
26117
26117
add a comment |Â
add a comment |Â
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.
@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
-notis 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[/testcommand in addition tofind.
â Stéphane Chazelas
Aug 27 at 14:01
add a comment |Â
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.
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â¯/700is equivalent tofindâ¯.â¯!â¯"("â¯-permâ¯-400â¯-oâ¯-permâ¯-200â¯-oâ¯-permâ¯-100â¯")"â which is equivalent tofindâ¯.â¯!â¯-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 +700works with thefindon Mac.
â ilkkachu
Aug 27 at 21:38
add a comment |Â
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.
Note that it was how GNUfind(from 1991 to 2013, deprecated after 2005) used to do it as well, but they replaced it with-perm /0700for POSIX compliance.
â Stéphane Chazelas
Aug 27 at 15:12
Sincesmakesupports this feature using+and since I am very sure thatsmakeis POSIX compliant, as it permits this special enhancement only in case that the+is followed by0,u,g,oora, I see no reason for this change.
â schily
Aug 27 at 15:20
find -perm +uis specified by POSIX (as being the same as-perm 0). It's not clear for-perm +0777, where+0777could 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 afterugoaor beforerwxand similar chars.
â schily
Aug 27 at 16:12
chmod +uis specified (gives all the same permission as the user, filtered by umask), sofind -perm +uis as well. Also note how thefind -permspec 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
 |Â
show 3 more comments
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.
@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
-notis 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[/testcommand in addition tofind.
â Stéphane Chazelas
Aug 27 at 14:01
add a comment |Â
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.
@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
-notis 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[/testcommand in addition tofind.
â Stéphane Chazelas
Aug 27 at 14:01
add a comment |Â
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.
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.
edited Aug 27 at 21:57
Stéphane Chazelas
283k53521855
283k53521855
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
-notis 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[/testcommand in addition tofind.
â Stéphane Chazelas
Aug 27 at 14:01
add a comment |Â
@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
-notis 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[/testcommand in addition tofind.
â 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
add a comment |Â
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.
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â¯/700is equivalent tofindâ¯.â¯!â¯"("â¯-permâ¯-400â¯-oâ¯-permâ¯-200â¯-oâ¯-permâ¯-100â¯")"â which is equivalent tofindâ¯.â¯!â¯-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 +700works with thefindon Mac.
â ilkkachu
Aug 27 at 21:38
add a comment |Â
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.
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â¯/700is equivalent tofindâ¯.â¯!â¯"("â¯-permâ¯-400â¯-oâ¯-permâ¯-200â¯-oâ¯-permâ¯-100â¯")"â which is equivalent tofindâ¯.â¯!â¯-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 +700works with thefindon Mac.
â ilkkachu
Aug 27 at 21:38
add a comment |Â
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.
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.
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â¯/700is equivalent tofindâ¯.â¯!â¯"("â¯-permâ¯-400â¯-oâ¯-permâ¯-200â¯-oâ¯-permâ¯-100â¯")"â which is equivalent tofindâ¯.â¯!â¯-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 +700works with thefindon Mac.
â ilkkachu
Aug 27 at 21:38
add a comment |Â
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â¯/700is equivalent tofindâ¯.â¯!â¯"("â¯-permâ¯-400â¯-oâ¯-permâ¯-200â¯-oâ¯-permâ¯-100â¯")"â which is equivalent tofindâ¯.â¯!â¯-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 +700works with thefindon 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
add a comment |Â
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.
Note that it was how GNUfind(from 1991 to 2013, deprecated after 2005) used to do it as well, but they replaced it with-perm /0700for POSIX compliance.
â Stéphane Chazelas
Aug 27 at 15:12
Sincesmakesupports this feature using+and since I am very sure thatsmakeis POSIX compliant, as it permits this special enhancement only in case that the+is followed by0,u,g,oora, I see no reason for this change.
â schily
Aug 27 at 15:20
find -perm +uis specified by POSIX (as being the same as-perm 0). It's not clear for-perm +0777, where+0777could 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 afterugoaor beforerwxand similar chars.
â schily
Aug 27 at 16:12
chmod +uis specified (gives all the same permission as the user, filtered by umask), sofind -perm +uis as well. Also note how thefind -permspec 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
 |Â
show 3 more comments
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.
Note that it was how GNUfind(from 1991 to 2013, deprecated after 2005) used to do it as well, but they replaced it with-perm /0700for POSIX compliance.
â Stéphane Chazelas
Aug 27 at 15:12
Sincesmakesupports this feature using+and since I am very sure thatsmakeis POSIX compliant, as it permits this special enhancement only in case that the+is followed by0,u,g,oora, I see no reason for this change.
â schily
Aug 27 at 15:20
find -perm +uis specified by POSIX (as being the same as-perm 0). It's not clear for-perm +0777, where+0777could 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 afterugoaor beforerwxand similar chars.
â schily
Aug 27 at 16:12
chmod +uis specified (gives all the same permission as the user, filtered by umask), sofind -perm +uis as well. Also note how thefind -permspec 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
 |Â
show 3 more comments
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.
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.
answered Aug 27 at 14:11
schily
9,53831437
9,53831437
Note that it was how GNUfind(from 1991 to 2013, deprecated after 2005) used to do it as well, but they replaced it with-perm /0700for POSIX compliance.
â Stéphane Chazelas
Aug 27 at 15:12
Sincesmakesupports this feature using+and since I am very sure thatsmakeis POSIX compliant, as it permits this special enhancement only in case that the+is followed by0,u,g,oora, I see no reason for this change.
â schily
Aug 27 at 15:20
find -perm +uis specified by POSIX (as being the same as-perm 0). It's not clear for-perm +0777, where+0777could 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 afterugoaor beforerwxand similar chars.
â schily
Aug 27 at 16:12
chmod +uis specified (gives all the same permission as the user, filtered by umask), sofind -perm +uis as well. Also note how thefind -permspec 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
 |Â
show 3 more comments
Note that it was how GNUfind(from 1991 to 2013, deprecated after 2005) used to do it as well, but they replaced it with-perm /0700for POSIX compliance.
â Stéphane Chazelas
Aug 27 at 15:12
Sincesmakesupports this feature using+and since I am very sure thatsmakeis POSIX compliant, as it permits this special enhancement only in case that the+is followed by0,u,g,oora, I see no reason for this change.
â schily
Aug 27 at 15:20
find -perm +uis specified by POSIX (as being the same as-perm 0). It's not clear for-perm +0777, where+0777could 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 afterugoaor beforerwxand similar chars.
â schily
Aug 27 at 16:12
chmod +uis specified (gives all the same permission as the user, filtered by umask), sofind -perm +uis as well. Also note how thefind -permspec 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
 |Â
show 3 more comments
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password