0

I want to change user permissions to execute hence the u+x via https://kb.iu.edu/d/abdb

I read {} is the thing "find" finds, and \; ends the command.

and also read -exec chmod just initiates the permission change.

I am able to successfully find the file, but permission still gets denied.

find / -name getUniqueGID.sh -exec chmod u+x {} \;

is wrong

Any thoughts?

closed as off-topic by cas, Archemar, jayhendren, Michael Homer, Rui F Ribeiro Jan 27 '18 at 20:39

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – cas, Archemar, jayhendren, Michael Homer, Rui F Ribeiro
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    That looks like it should add execute permission on getUniqueGID.sh, or actually any files named that on the system. Do you get some errors? What does ls -l getUniqueGID.sh show? – ilkkachu Jan 26 '18 at 6:32
  • @ilkkachu I don't get any errors. In my assignment the file is hidden deep somewhere so ls -l filename doesn't show anything. Only find works easily. – grilam14 Jan 26 '18 at 6:34
  • I suppose you'd need the path anyway to be able to execute the script at the end, though find can give that quite easily. But anyway, chmod should give an error if you can't change the permissions of the file. Unless find doesn't find the file at all, but you said you can find it. I'm missing something here. – ilkkachu Jan 26 '18 at 6:38
  • @ilkkachu Here is the question: Write the unix command used to find the number of lines in question 6 to a script file named getUniqueGID.sh What is the command to run this script file? Did you encounter “permission denied” error? (yes) Change the permissions of the file to allow users to execute the file. (how?) What is the command used to changed file access permissions? (idk) Did the script run this time? Maybe I got the first part wrong. I can't tell. – grilam14 Jan 26 '18 at 6:39
  • 1
    Your find command looks fine; I suspect Kusalananda is on the right path, and that all you may need is a “simple” chmod command. It’s tough for us to answer homework-type questions like this as there may be more than one way to accomplish a goal, but the teacher/grader may have a specific command in mind. – Jeff Schaller Jan 26 '18 at 10:41
2

From reading the comments to the question, it seems as if you have misunderstood the question in the assignment. It asks you to

  1. Put the command(s) that you used in some other question into a new file called getUniqueGID.sh.
  2. Try executing that new file.
  3. Make the file executable by all.

The file is not hidden away somewhere on the system; you should create it. Once you have, a slightly modified version of the chmod part of your (too advanced) solution will be enough to make it executable for all users. No find will be used in the answer, as far as I can tell.

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