How to `find` all files and folders with 0** permissions?
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 |
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 |
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
shell permissions find osx
edited Aug 27 '18 at 13:42
Stephen Kitt
174k24398473
174k24398473
asked Aug 27 '18 at 13:25
ylluminateylluminate
27618
27618
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
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 '18 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 tofind
.
– Stéphane Chazelas
Aug 27 '18 at 14:01
add a comment |
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 '18 at 13:34
1
Ah, sorry,-perm /
is a GNU extension which matches any of the given permission bits.
– Stephen Kitt
Aug 27 '18 at 13:41
Thanks for clarifying, that would have been great and the answer had it worked for macOS'find
.
– ylluminate
Aug 27 '18 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 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 '18 at 21:35
1
@ylluminate,find . ! -perm +700
works with thefind
on Mac.
– ilkkachu
Aug 27 '18 at 21:38
add a comment |
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 /0700
for POSIX compliance.
– Stéphane Chazelas
Aug 27 '18 at 15:12
Sincesmake
supports this feature using+
and since I am very sure thatsmake
is POSIX compliant, as it permits this special enhancement only in case that the+
is followed by0
,u
,g
,o
ora
, I see no reason for this change.
– schily
Aug 27 '18 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 '18 at 15:45
Sorry, this is not in the POSIX standard. The plus sign is only specified afterugoa
or beforerwx
and similar chars.
– schily
Aug 27 '18 at 16:12
chmod +u
is specified (gives all the same permission as the user, filtered by umask), sofind -perm +u
is as well. Also note how thefind -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 '18 at 16:16
|
show 3 more comments
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',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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
);
);
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
Required, but never shown
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
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
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 '18 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 tofind
.
– Stéphane Chazelas
Aug 27 '18 at 14:01
add a comment |
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 '18 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 tofind
.
– Stéphane Chazelas
Aug 27 '18 at 14:01
add a comment |
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 '18 at 21:57
Stéphane Chazelas
308k57581939
308k57581939
answered Aug 27 '18 at 13:53
AlexanderAlexander
1,1611213
1,1611213
@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 '18 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 tofind
.
– Stéphane Chazelas
Aug 27 '18 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 '18 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 tofind
.
– Stéphane Chazelas
Aug 27 '18 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 '18 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 '18 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 '18 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 '18 at 14:01
add a comment |
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 '18 at 13:34
1
Ah, sorry,-perm /
is a GNU extension which matches any of the given permission bits.
– Stephen Kitt
Aug 27 '18 at 13:41
Thanks for clarifying, that would have been great and the answer had it worked for macOS'find
.
– ylluminate
Aug 27 '18 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 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 '18 at 21:35
1
@ylluminate,find . ! -perm +700
works with thefind
on Mac.
– ilkkachu
Aug 27 '18 at 21:38
add a comment |
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 '18 at 13:34
1
Ah, sorry,-perm /
is a GNU extension which matches any of the given permission bits.
– Stephen Kitt
Aug 27 '18 at 13:41
Thanks for clarifying, that would have been great and the answer had it worked for macOS'find
.
– ylluminate
Aug 27 '18 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 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 '18 at 21:35
1
@ylluminate,find . ! -perm +700
works with thefind
on Mac.
– ilkkachu
Aug 27 '18 at 21:38
add a comment |
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 '18 at 6:56
answered Aug 27 '18 at 13:29
Stephen KittStephen Kitt
174k24398473
174k24398473
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 '18 at 13:34
1
Ah, sorry,-perm /
is a GNU extension which matches any of the given permission bits.
– Stephen Kitt
Aug 27 '18 at 13:41
Thanks for clarifying, that would have been great and the answer had it worked for macOS'find
.
– ylluminate
Aug 27 '18 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 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 '18 at 21:35
1
@ylluminate,find . ! -perm +700
works with thefind
on Mac.
– ilkkachu
Aug 27 '18 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 '18 at 13:34
1
Ah, sorry,-perm /
is a GNU extension which matches any of the given permission bits.
– Stephen Kitt
Aug 27 '18 at 13:41
Thanks for clarifying, that would have been great and the answer had it worked for macOS'find
.
– ylluminate
Aug 27 '18 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 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 '18 at 21:35
1
@ylluminate,find . ! -perm +700
works with thefind
on Mac.
– ilkkachu
Aug 27 '18 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 '18 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 '18 at 13:34
1
1
Ah, sorry,
-perm /
is a GNU extension which matches any of the given permission bits.– Stephen Kitt
Aug 27 '18 at 13:41
Ah, sorry,
-perm /
is a GNU extension which matches any of the given permission bits.– Stephen Kitt
Aug 27 '18 at 13:41
Thanks for clarifying, that would have been great and the answer had it worked for macOS'
find
.– ylluminate
Aug 27 '18 at 19:10
Thanks for clarifying, that would have been great and the answer had it worked for macOS'
find
.– ylluminate
Aug 27 '18 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 '18 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 '18 at 21:35
1
1
@ylluminate,
find . ! -perm +700
works with the find
on Mac.– ilkkachu
Aug 27 '18 at 21:38
@ylluminate,
find . ! -perm +700
works with the find
on Mac.– ilkkachu
Aug 27 '18 at 21:38
add a comment |
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 /0700
for POSIX compliance.
– Stéphane Chazelas
Aug 27 '18 at 15:12
Sincesmake
supports this feature using+
and since I am very sure thatsmake
is POSIX compliant, as it permits this special enhancement only in case that the+
is followed by0
,u
,g
,o
ora
, I see no reason for this change.
– schily
Aug 27 '18 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 '18 at 15:45
Sorry, this is not in the POSIX standard. The plus sign is only specified afterugoa
or beforerwx
and similar chars.
– schily
Aug 27 '18 at 16:12
chmod +u
is specified (gives all the same permission as the user, filtered by umask), sofind -perm +u
is as well. Also note how thefind -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 '18 at 16:16
|
show 3 more comments
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 /0700
for POSIX compliance.
– Stéphane Chazelas
Aug 27 '18 at 15:12
Sincesmake
supports this feature using+
and since I am very sure thatsmake
is POSIX compliant, as it permits this special enhancement only in case that the+
is followed by0
,u
,g
,o
ora
, I see no reason for this change.
– schily
Aug 27 '18 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 '18 at 15:45
Sorry, this is not in the POSIX standard. The plus sign is only specified afterugoa
or beforerwx
and similar chars.
– schily
Aug 27 '18 at 16:12
chmod +u
is specified (gives all the same permission as the user, filtered by umask), sofind -perm +u
is as well. Also note how thefind -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 '18 at 16:16
|
show 3 more comments
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 '18 at 14:11
schilyschily
10.8k31641
10.8k31641
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 /0700
for POSIX compliance.
– Stéphane Chazelas
Aug 27 '18 at 15:12
Sincesmake
supports this feature using+
and since I am very sure thatsmake
is POSIX compliant, as it permits this special enhancement only in case that the+
is followed by0
,u
,g
,o
ora
, I see no reason for this change.
– schily
Aug 27 '18 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 '18 at 15:45
Sorry, this is not in the POSIX standard. The plus sign is only specified afterugoa
or beforerwx
and similar chars.
– schily
Aug 27 '18 at 16:12
chmod +u
is specified (gives all the same permission as the user, filtered by umask), sofind -perm +u
is as well. Also note how thefind -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 '18 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 /0700
for POSIX compliance.
– Stéphane Chazelas
Aug 27 '18 at 15:12
Sincesmake
supports this feature using+
and since I am very sure thatsmake
is POSIX compliant, as it permits this special enhancement only in case that the+
is followed by0
,u
,g
,o
ora
, I see no reason for this change.
– schily
Aug 27 '18 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 '18 at 15:45
Sorry, this is not in the POSIX standard. The plus sign is only specified afterugoa
or beforerwx
and similar chars.
– schily
Aug 27 '18 at 16:12
chmod +u
is specified (gives all the same permission as the user, filtered by umask), sofind -perm +u
is as well. Also note how thefind -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 '18 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 '18 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 '18 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 '18 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 '18 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 '18 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 '18 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 '18 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 '18 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 '18 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 '18 at 16:16
|
show 3 more comments
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- 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.
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
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
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