3.9 of 5 3,100 reviews Cupertino, CA 5000+ Employees

Apple Software Engineer Interview Question (student candidate)

"If you had to change permissions to read/write all recursively in the unix terminal, how would you do it?"
Add Tags [?]
Answer Flag Question

Part of a Software Engineer Interview Review - one of 2,082 Apple Interview Reviews

Answers & Comments

of 5
chmod -r 777 file/path/here
- Interview Candidate on Nov 9, 2009 Flag Response
of 5
actually, the correct answer is

chmod -R 766 filename
- Tom on Nov 21, 2009 Flag Response
of 6
For crying out loud, people, check your answers:

chmod -R 666 [pathname]


chmod is the command

-R is the flag for recursive

666 is the octal permission for read+write for user/group/other

[pathname] is the item to apply the permission changes to. It should be a directory (not a file) as the recursive option has no meaning on a simple file.

A "7" adds execute permission, which is not what was stated.
- Tim on Jan 13, 2010 Flag Response
of 8
Be careful - chmod -R 666 will remove the execute bit from directories below the one you're in. That will mean that for example the directory listing command will fail.

As stated, the question doesn't ask you to avoid ruining your directory permissions - but it does ask "how you would do it".

I use this, which makes sure to only change the permissions of files:

find . -type f -exec chmod 0666 \{} \;
- Sarah on Jan 13, 2010 Flag Response
of 12
As Sarah commented, you don't want to remove execute permissions from directories, just add read and write for all users. The other way to do this without using the 'find' program is:

chmod -R a+rw /path
- Brooks on Jan 18, 2010 Flag Response
of 4
My answer: use an iphone.
- Anonymous on Jan 12, 2011 Flag Response

To comment on this question, Sign In with Facebook or Sign Up

Tags are like keywords that help categorize interview questions that have something in common.

Glassdoor is your free inside look at Apple interview questions and advice. All interview reviews posted anonymously by Apple employees and interview candidates.