0

I am trying to look for all files with xyz in their filenames in my working directory and then change their permissions in symbolic mode.

find . -type f -name *xyz* ; chmod -v u=a+wx {}\;   

I get an error:

chmod: invalid mode: ‘–v’
Try 'chmod --help' for more information.

when I remove the -v, I get the same error. Not sure what I am doing wrong.

  • find . -type f -name xyz ; chmod -v u=a+wx {} \; I forgot to show the space. It shows the same error. – Steve Alx Oct 15 '15 at 17:11
  • You can edit posts. – phk Oct 15 '15 at 17:13
  • 1
    maybe you just want chmod a+wx ? "a" includes "u" (and "g" and "o"). – Jeff Schaller Oct 15 '15 at 17:15
  • 2
    Also some more info on distribution, bash version etc. would help us help you. Also, you might want to try --exec instead of the non-escaped semicolon. Could be that you chmod simply does not support this feature, you might want to try chattr instead. – phk Oct 15 '15 at 17:16
  • first get your chmod working properly on one file, before you trawl through the directory using find. – X Tian Oct 15 '15 at 17:22
2

The find -exec syntax is:

find … -exec command {} \;

you've instead got a ; instead of -exec and you need a space between {} and \;.

Finally, your mode is, err, not right. Maybe you were going for u=,a+wx—remove all permissions for the owner, then give everyone write and execute? Which results in -wx-wx-wx, an odd set of permissions. No idea what permissions you intended.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.