How to chmod files that have a specific set of permissionschmod: permissions of a directory don't changeHaving trouble with chmodSite creation script - missing chmod permissionsBest practices for permissions in major directories in UbuntuPermission denied for 'sudo' after 'sudo chmod 666 /usr'Setting permissions for /var/www/mysite?chmod hard drive at grub?I set permission with chmod, but files created later don't have the same permissionsFix permissions of server after accidental chmodchmod does not seem to be changing permissions of a sd card

Have I saved too much for retirement so far?

There is only s̶i̶x̶t̶y one place he can be

Dot above capital letter not centred

Valid Badminton Score?

Is there any reason not to eat food that's been dropped on the surface of the moon?

Implement the Thanos sorting algorithm

What is the intuitive meaning of having a linear relationship between the logs of two variables?

Is there any easy technique written in Bhagavad GITA to control lust?

Is expanding the research of a group into machine learning as a PhD student risky?

Products and sum of cubes in Fibonacci

Is exact Kanji stroke length important?

At which point does a character regain all their Hit Dice?

Why did Kant, Hegel, and Adorno leave some words and phrases in the Greek alphabet?

Short story about space worker geeks who zone out by 'listening' to radiation from stars

Why Were Madagascar and New Zealand Discovered So Late?

Can I Retrieve Email Addresses from BCC?

Is there a problem with hiding "forgot password" until it's needed?

Trouble understanding overseas colleagues

apt-get update is failing in debian

How do I rename a LINUX host without needing to reboot for the rename to take effect?

Teaching indefinite integrals that require special-casing

Generic lambda vs generic function give different behaviour

Do there exist finite commutative rings with identity that are not Bézout rings?

Applicability of Single Responsibility Principle



How to chmod files that have a specific set of permissions


chmod: permissions of a directory don't changeHaving trouble with chmodSite creation script - missing chmod permissionsBest practices for permissions in major directories in UbuntuPermission denied for 'sudo' after 'sudo chmod 666 /usr'Setting permissions for /var/www/mysite?chmod hard drive at grub?I set permission with chmod, but files created later don't have the same permissionsFix permissions of server after accidental chmodchmod does not seem to be changing permissions of a sd card













5















I want to find all files in a folder that have -rw-r----- (640? is that the right code?) permissions, and change them all to have -rw-rw-rw- instead. How do I do this, with chmod?



I know I could do the whole folder with



sudo chmod -R 666 /path/to/folder


but I think (perhaps mistakenly?) that it would be more efficient to just do the ones that actually need it?



Alternatively, rather than specifically looking for -rw-r-----, I could chmod any file that doesn't have 666 already? Would that be better?










share|improve this question
























  • You definitely do not want to do chmod -R 666, since it would remove the executable bit from the folder, making it unbrowseable. chmod -R a=rwX maybe.

    – fkraiem
    Mar 7 at 10:44






  • 1





    Yes that just occurred to me - I think chmod -R +r,+w might be best. There shouldn't be any executable stuff in that folder anyway.

    – Max Williams
    Mar 7 at 10:54











  • If there's nothing executable, including no subfolders, no need for -R, just do chmod 666 /path/*.

    – fkraiem
    Mar 7 at 10:58











  • Just to be clear, yes rw-r----- == 640

    – wjandrea
    Mar 7 at 18:57















5















I want to find all files in a folder that have -rw-r----- (640? is that the right code?) permissions, and change them all to have -rw-rw-rw- instead. How do I do this, with chmod?



I know I could do the whole folder with



sudo chmod -R 666 /path/to/folder


but I think (perhaps mistakenly?) that it would be more efficient to just do the ones that actually need it?



Alternatively, rather than specifically looking for -rw-r-----, I could chmod any file that doesn't have 666 already? Would that be better?










share|improve this question
























  • You definitely do not want to do chmod -R 666, since it would remove the executable bit from the folder, making it unbrowseable. chmod -R a=rwX maybe.

    – fkraiem
    Mar 7 at 10:44






  • 1





    Yes that just occurred to me - I think chmod -R +r,+w might be best. There shouldn't be any executable stuff in that folder anyway.

    – Max Williams
    Mar 7 at 10:54











  • If there's nothing executable, including no subfolders, no need for -R, just do chmod 666 /path/*.

    – fkraiem
    Mar 7 at 10:58











  • Just to be clear, yes rw-r----- == 640

    – wjandrea
    Mar 7 at 18:57













5












5








5








I want to find all files in a folder that have -rw-r----- (640? is that the right code?) permissions, and change them all to have -rw-rw-rw- instead. How do I do this, with chmod?



I know I could do the whole folder with



sudo chmod -R 666 /path/to/folder


but I think (perhaps mistakenly?) that it would be more efficient to just do the ones that actually need it?



Alternatively, rather than specifically looking for -rw-r-----, I could chmod any file that doesn't have 666 already? Would that be better?










share|improve this question
















I want to find all files in a folder that have -rw-r----- (640? is that the right code?) permissions, and change them all to have -rw-rw-rw- instead. How do I do this, with chmod?



I know I could do the whole folder with



sudo chmod -R 666 /path/to/folder


but I think (perhaps mistakenly?) that it would be more efficient to just do the ones that actually need it?



Alternatively, rather than specifically looking for -rw-r-----, I could chmod any file that doesn't have 666 already? Would that be better?







chmod






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 7 at 13:46









Braiam

52.4k20138223




52.4k20138223










asked Mar 7 at 10:36









Max WilliamsMax Williams

857




857












  • You definitely do not want to do chmod -R 666, since it would remove the executable bit from the folder, making it unbrowseable. chmod -R a=rwX maybe.

    – fkraiem
    Mar 7 at 10:44






  • 1





    Yes that just occurred to me - I think chmod -R +r,+w might be best. There shouldn't be any executable stuff in that folder anyway.

    – Max Williams
    Mar 7 at 10:54











  • If there's nothing executable, including no subfolders, no need for -R, just do chmod 666 /path/*.

    – fkraiem
    Mar 7 at 10:58











  • Just to be clear, yes rw-r----- == 640

    – wjandrea
    Mar 7 at 18:57

















  • You definitely do not want to do chmod -R 666, since it would remove the executable bit from the folder, making it unbrowseable. chmod -R a=rwX maybe.

    – fkraiem
    Mar 7 at 10:44






  • 1





    Yes that just occurred to me - I think chmod -R +r,+w might be best. There shouldn't be any executable stuff in that folder anyway.

    – Max Williams
    Mar 7 at 10:54











  • If there's nothing executable, including no subfolders, no need for -R, just do chmod 666 /path/*.

    – fkraiem
    Mar 7 at 10:58











  • Just to be clear, yes rw-r----- == 640

    – wjandrea
    Mar 7 at 18:57
















You definitely do not want to do chmod -R 666, since it would remove the executable bit from the folder, making it unbrowseable. chmod -R a=rwX maybe.

– fkraiem
Mar 7 at 10:44





You definitely do not want to do chmod -R 666, since it would remove the executable bit from the folder, making it unbrowseable. chmod -R a=rwX maybe.

– fkraiem
Mar 7 at 10:44




1




1





Yes that just occurred to me - I think chmod -R +r,+w might be best. There shouldn't be any executable stuff in that folder anyway.

– Max Williams
Mar 7 at 10:54





Yes that just occurred to me - I think chmod -R +r,+w might be best. There shouldn't be any executable stuff in that folder anyway.

– Max Williams
Mar 7 at 10:54













If there's nothing executable, including no subfolders, no need for -R, just do chmod 666 /path/*.

– fkraiem
Mar 7 at 10:58





If there's nothing executable, including no subfolders, no need for -R, just do chmod 666 /path/*.

– fkraiem
Mar 7 at 10:58













Just to be clear, yes rw-r----- == 640

– wjandrea
Mar 7 at 18:57





Just to be clear, yes rw-r----- == 640

– wjandrea
Mar 7 at 18:57










1 Answer
1






active

oldest

votes


















16














find /path/to/folder -perm 640 -exec chmod 666 ;





share|improve this answer




















  • 6





    To find only files (not oddly-specified directories) with permissions 640, add -type f eg: find -type f /path/to/folder -perm 640 -exec chmod 666 ;

    – Pelle
    Mar 7 at 13:16







  • 5





    And don't forget about using + instead of ; with -exec so it only runs chmod once, instead of separately for each file.

    – Barmar
    Mar 7 at 17:13










Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1123746%2fhow-to-chmod-files-that-have-a-specific-set-of-permissions%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









16














find /path/to/folder -perm 640 -exec chmod 666 ;





share|improve this answer




















  • 6





    To find only files (not oddly-specified directories) with permissions 640, add -type f eg: find -type f /path/to/folder -perm 640 -exec chmod 666 ;

    – Pelle
    Mar 7 at 13:16







  • 5





    And don't forget about using + instead of ; with -exec so it only runs chmod once, instead of separately for each file.

    – Barmar
    Mar 7 at 17:13















16














find /path/to/folder -perm 640 -exec chmod 666 ;





share|improve this answer




















  • 6





    To find only files (not oddly-specified directories) with permissions 640, add -type f eg: find -type f /path/to/folder -perm 640 -exec chmod 666 ;

    – Pelle
    Mar 7 at 13:16







  • 5





    And don't forget about using + instead of ; with -exec so it only runs chmod once, instead of separately for each file.

    – Barmar
    Mar 7 at 17:13













16












16








16







find /path/to/folder -perm 640 -exec chmod 666 ;





share|improve this answer















find /path/to/folder -perm 640 -exec chmod 666 ;






share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 7 at 10:51

























answered Mar 7 at 10:48









mucluxmuclux

3,28611130




3,28611130







  • 6





    To find only files (not oddly-specified directories) with permissions 640, add -type f eg: find -type f /path/to/folder -perm 640 -exec chmod 666 ;

    – Pelle
    Mar 7 at 13:16







  • 5





    And don't forget about using + instead of ; with -exec so it only runs chmod once, instead of separately for each file.

    – Barmar
    Mar 7 at 17:13












  • 6





    To find only files (not oddly-specified directories) with permissions 640, add -type f eg: find -type f /path/to/folder -perm 640 -exec chmod 666 ;

    – Pelle
    Mar 7 at 13:16







  • 5





    And don't forget about using + instead of ; with -exec so it only runs chmod once, instead of separately for each file.

    – Barmar
    Mar 7 at 17:13







6




6





To find only files (not oddly-specified directories) with permissions 640, add -type f eg: find -type f /path/to/folder -perm 640 -exec chmod 666 ;

– Pelle
Mar 7 at 13:16






To find only files (not oddly-specified directories) with permissions 640, add -type f eg: find -type f /path/to/folder -perm 640 -exec chmod 666 ;

– Pelle
Mar 7 at 13:16





5




5





And don't forget about using + instead of ; with -exec so it only runs chmod once, instead of separately for each file.

– Barmar
Mar 7 at 17:13





And don't forget about using + instead of ; with -exec so it only runs chmod once, instead of separately for each file.

– Barmar
Mar 7 at 17:13

















draft saved

draft discarded
















































Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1123746%2fhow-to-chmod-files-that-have-a-specific-set-of-permissions%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

1928 у кіно

Захаров Федір Захарович

Ель Греко