Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'd like to give execute permissions on a path recursively so I can read a file in the directory. The chmod binary that I'm using on Android only supports the octal/numeric notation though.

Normally I'd do chmod -R a+x /this/file/is/here/filename.txt but don't know how I'd do this numerically. I've Googled but haven't found an answer to this.


Looking at at the question "Is it possible to represent the +X symbolic permission with an octal value?", I don't think this is possible but what would the easiest recommended way.

share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted

You cannot do that using octal notation. Octal notation only allows you to set all mode bits and the +x allows to add to existing mode bits.

If you have find on the system, you can write a script that uses find to search for directories a specific combination of mode bits with -perm and change only those to the pattern including the execute bits.

@Wally's solution will not work because directories A and B:

-rwxrwxr-- A
-rwxr-xr-- B

will both become rwxr-xr-x with his solutions but with chmod a+x:

-rwxrwxr-x A
-rwxr-xr-x B
share|improve this answer
add comment

Permissions with chmod are as follows:

User (r-w-e)
User's primary group (r-w-e)
Everyone (r-w-e)

You probably want to give permissions as follows:

chmod 755

Which gives User: rwe, Group: re, Everyone: re

It's usually helpful to have the read-execute together, rather than just execute.

share|improve this answer
add comment

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.