Use chmod recursively to increase permissions for files and directories below a threshold but do not change those that are already above the threshold [closed]
I am using Linux (RHEL 7.5) and have a directory containing some files and directories that have 750 permissions (or lower), and some files and directories that have 777 permissions.
I wish to increase the permissions (recursively) for those files and directories that are at 750 (or below) to 755, but to leave those that have permissions 777 as they are.
How can I accomplish this selective "ratcheting up" of permissions?
linux bash unix permissions chmod
closed as off-topic by Barmar, Tsyvarev, Rob, Andy Jones, Graham Nov 13 '18 at 0:57
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions about general computing hardware and software are off-topic for Stack Overflow unless they directly involve tools used primarily for programming. You may be able to get help on Super User." – Barmar, Tsyvarev, Rob, Andy Jones, Graham
add a comment |
I am using Linux (RHEL 7.5) and have a directory containing some files and directories that have 750 permissions (or lower), and some files and directories that have 777 permissions.
I wish to increase the permissions (recursively) for those files and directories that are at 750 (or below) to 755, but to leave those that have permissions 777 as they are.
How can I accomplish this selective "ratcheting up" of permissions?
linux bash unix permissions chmod
closed as off-topic by Barmar, Tsyvarev, Rob, Andy Jones, Graham Nov 13 '18 at 0:57
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions about general computing hardware and software are off-topic for Stack Overflow unless they directly involve tools used primarily for programming. You may be able to get help on Super User." – Barmar, Tsyvarev, Rob, Andy Jones, Graham
According toman(you did read man, right?) you can use + to add bits and - to subtract bits.
– Gem Taylor
Nov 12 '18 at 20:08
Thanks for your reply. I did read man chmod, and I think you are referring to this section: "The operator + causes the selected file mode bits to be added to the existing file mode bits of each file; - causes them to be removed; and = causes them to be added and causes unmentioned bits to be removed except that a directory's unmentioned set user and group ID bits are not affected." I think I'm failing to understand something fundamental about chmod--can you please explain to me how the + and - can be used to solve my problem?
– 0012
Nov 12 '18 at 20:15
1
You want to add therandxpermissions to others. If the permissions are already777, it won't change anything. If the permissions are750it will change to755.
– Barmar
Nov 12 '18 at 20:21
Stack Overflow is for programming questions, not questions about using or configuring Linux and its applications. Super User or Unix & Linux would be better places for questions like this.
– Barmar
Nov 12 '18 at 20:21
1
So it should beo+rx.
– Barmar
Nov 12 '18 at 20:22
add a comment |
I am using Linux (RHEL 7.5) and have a directory containing some files and directories that have 750 permissions (or lower), and some files and directories that have 777 permissions.
I wish to increase the permissions (recursively) for those files and directories that are at 750 (or below) to 755, but to leave those that have permissions 777 as they are.
How can I accomplish this selective "ratcheting up" of permissions?
linux bash unix permissions chmod
I am using Linux (RHEL 7.5) and have a directory containing some files and directories that have 750 permissions (or lower), and some files and directories that have 777 permissions.
I wish to increase the permissions (recursively) for those files and directories that are at 750 (or below) to 755, but to leave those that have permissions 777 as they are.
How can I accomplish this selective "ratcheting up" of permissions?
linux bash unix permissions chmod
linux bash unix permissions chmod
asked Nov 12 '18 at 19:51
00120012
3817
3817
closed as off-topic by Barmar, Tsyvarev, Rob, Andy Jones, Graham Nov 13 '18 at 0:57
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions about general computing hardware and software are off-topic for Stack Overflow unless they directly involve tools used primarily for programming. You may be able to get help on Super User." – Barmar, Tsyvarev, Rob, Andy Jones, Graham
closed as off-topic by Barmar, Tsyvarev, Rob, Andy Jones, Graham Nov 13 '18 at 0:57
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions about general computing hardware and software are off-topic for Stack Overflow unless they directly involve tools used primarily for programming. You may be able to get help on Super User." – Barmar, Tsyvarev, Rob, Andy Jones, Graham
According toman(you did read man, right?) you can use + to add bits and - to subtract bits.
– Gem Taylor
Nov 12 '18 at 20:08
Thanks for your reply. I did read man chmod, and I think you are referring to this section: "The operator + causes the selected file mode bits to be added to the existing file mode bits of each file; - causes them to be removed; and = causes them to be added and causes unmentioned bits to be removed except that a directory's unmentioned set user and group ID bits are not affected." I think I'm failing to understand something fundamental about chmod--can you please explain to me how the + and - can be used to solve my problem?
– 0012
Nov 12 '18 at 20:15
1
You want to add therandxpermissions to others. If the permissions are already777, it won't change anything. If the permissions are750it will change to755.
– Barmar
Nov 12 '18 at 20:21
Stack Overflow is for programming questions, not questions about using or configuring Linux and its applications. Super User or Unix & Linux would be better places for questions like this.
– Barmar
Nov 12 '18 at 20:21
1
So it should beo+rx.
– Barmar
Nov 12 '18 at 20:22
add a comment |
According toman(you did read man, right?) you can use + to add bits and - to subtract bits.
– Gem Taylor
Nov 12 '18 at 20:08
Thanks for your reply. I did read man chmod, and I think you are referring to this section: "The operator + causes the selected file mode bits to be added to the existing file mode bits of each file; - causes them to be removed; and = causes them to be added and causes unmentioned bits to be removed except that a directory's unmentioned set user and group ID bits are not affected." I think I'm failing to understand something fundamental about chmod--can you please explain to me how the + and - can be used to solve my problem?
– 0012
Nov 12 '18 at 20:15
1
You want to add therandxpermissions to others. If the permissions are already777, it won't change anything. If the permissions are750it will change to755.
– Barmar
Nov 12 '18 at 20:21
Stack Overflow is for programming questions, not questions about using or configuring Linux and its applications. Super User or Unix & Linux would be better places for questions like this.
– Barmar
Nov 12 '18 at 20:21
1
So it should beo+rx.
– Barmar
Nov 12 '18 at 20:22
According to
man (you did read man, right?) you can use + to add bits and - to subtract bits.– Gem Taylor
Nov 12 '18 at 20:08
According to
man (you did read man, right?) you can use + to add bits and - to subtract bits.– Gem Taylor
Nov 12 '18 at 20:08
Thanks for your reply. I did read man chmod, and I think you are referring to this section: "The operator + causes the selected file mode bits to be added to the existing file mode bits of each file; - causes them to be removed; and = causes them to be added and causes unmentioned bits to be removed except that a directory's unmentioned set user and group ID bits are not affected." I think I'm failing to understand something fundamental about chmod--can you please explain to me how the + and - can be used to solve my problem?
– 0012
Nov 12 '18 at 20:15
Thanks for your reply. I did read man chmod, and I think you are referring to this section: "The operator + causes the selected file mode bits to be added to the existing file mode bits of each file; - causes them to be removed; and = causes them to be added and causes unmentioned bits to be removed except that a directory's unmentioned set user and group ID bits are not affected." I think I'm failing to understand something fundamental about chmod--can you please explain to me how the + and - can be used to solve my problem?
– 0012
Nov 12 '18 at 20:15
1
1
You want to add the
r and x permissions to others. If the permissions are already 777, it won't change anything. If the permissions are 750 it will change to 755.– Barmar
Nov 12 '18 at 20:21
You want to add the
r and x permissions to others. If the permissions are already 777, it won't change anything. If the permissions are 750 it will change to 755.– Barmar
Nov 12 '18 at 20:21
Stack Overflow is for programming questions, not questions about using or configuring Linux and its applications. Super User or Unix & Linux would be better places for questions like this.
– Barmar
Nov 12 '18 at 20:21
Stack Overflow is for programming questions, not questions about using or configuring Linux and its applications. Super User or Unix & Linux would be better places for questions like this.
– Barmar
Nov 12 '18 at 20:21
1
1
So it should be
o+rx.– Barmar
Nov 12 '18 at 20:22
So it should be
o+rx.– Barmar
Nov 12 '18 at 20:22
add a comment |
1 Answer
1
active
oldest
votes
You can add permissions using the + operator, so to make sure they are at least 755 you can do chmod -R u+rwx,go+rx /some/path - in other words, make sure the user has read, write and executable rights, and that group and other have read and execute.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can add permissions using the + operator, so to make sure they are at least 755 you can do chmod -R u+rwx,go+rx /some/path - in other words, make sure the user has read, write and executable rights, and that group and other have read and execute.
add a comment |
You can add permissions using the + operator, so to make sure they are at least 755 you can do chmod -R u+rwx,go+rx /some/path - in other words, make sure the user has read, write and executable rights, and that group and other have read and execute.
add a comment |
You can add permissions using the + operator, so to make sure they are at least 755 you can do chmod -R u+rwx,go+rx /some/path - in other words, make sure the user has read, write and executable rights, and that group and other have read and execute.
You can add permissions using the + operator, so to make sure they are at least 755 you can do chmod -R u+rwx,go+rx /some/path - in other words, make sure the user has read, write and executable rights, and that group and other have read and execute.
answered Nov 12 '18 at 20:47
l0b0l0b0
33.8k1585147
33.8k1585147
add a comment |
add a comment |
According to
man(you did read man, right?) you can use + to add bits and - to subtract bits.– Gem Taylor
Nov 12 '18 at 20:08
Thanks for your reply. I did read man chmod, and I think you are referring to this section: "The operator + causes the selected file mode bits to be added to the existing file mode bits of each file; - causes them to be removed; and = causes them to be added and causes unmentioned bits to be removed except that a directory's unmentioned set user and group ID bits are not affected." I think I'm failing to understand something fundamental about chmod--can you please explain to me how the + and - can be used to solve my problem?
– 0012
Nov 12 '18 at 20:15
1
You want to add the
randxpermissions to others. If the permissions are already777, it won't change anything. If the permissions are750it will change to755.– Barmar
Nov 12 '18 at 20:21
Stack Overflow is for programming questions, not questions about using or configuring Linux and its applications. Super User or Unix & Linux would be better places for questions like this.
– Barmar
Nov 12 '18 at 20:21
1
So it should be
o+rx.– Barmar
Nov 12 '18 at 20:22