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

Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved