Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I wished to have a given folder and file and all descendants, write permissions.

I wished that ALL files and folders could be recursively granted he following permissions: 777

So I tried:

chmod -r 777 ~/Folder/app/

I then got something like:

chmod: 777: No such file or directory

I then did go to ~/Folder/app/ and tried to do a ls -la to check on permissions.

I get:

.: Permission Denied

I then did:

sudo ls -la

and then I've seen that .. special folder has: 777 permissions, but not the others.

How can I revert this, without deleting the ~/Folder/app/ folder ?

I mean: How can we allow the ls to work again without typing sudo inside that folder ? And somehow fix the mess I made by using -r instead of -R ?

share|improve this question
    
To my understanding, for recursive action, you need either --recursive or -R. I just want to make sure that what you put in your question is the command you actually used (to avoid misunderstandings) :) –  Oliver Salzburg Jun 4 '12 at 12:26
    
Yes, I've used -r instead of the CAPITAL -R so, I've used -r lowercase. –  MEM Jun 4 '12 at 12:27
    
You almost certainly almost never want 777, by the way. –  Dennis Williamson Jun 4 '12 at 12:28
    
@MEM: That may be your whole problem. –  Oliver Salzburg Jun 4 '12 at 12:28
    
@OliverSalzburg : I realize that. The problem is, I don't know how to revert this. :/ –  MEM Jun 4 '12 at 12:30

1 Answer 1

up vote 3 down vote accepted

As I noted in my comments, you need to either supply --recursive or -R (capital R) to chmod so it works recursively.

-r (lower case R) means remove read permissions (at least to my understanding). This operation would then be applied to the next parameter, which is 777.

So your call would remove read permissions from a file named 777. That file does not exist, thus, the error message

chmod: 777: No such file or directory

I'm not sure if chmod then aborted or if it tried to remove read permissions from the next parameter ~/Folder/app/.
In the latter case, it would even remove read permissions from your folder, doing exactly the opposite of what you wanted in the first place :)

Now, to resolve this, just use the correct syntax:

chmod --recursive 777 ~/Folder/app/

That will add the read permissions back (and apply your 777 mode on all children of that folder). Please take note of Dennis Williamson's comment, you almost never want to set a mode of 777.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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