Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am developing a website hosted locally on a Mac and I am having trouble with directory permissions.

I have exhausted my normal options for solving the problem and the remaining solution I can think of is to try setting permissions in the terminal. I've never used the terminal seriously and I hoping someone could give me directions to do this.

What I need to do:

Direct terminal to hard-drive/Applications/MAMP/htdocs/mysite/myfolder/mysubfolder

( Ls -l doesn't return Applications which is confusing).

Set the permissions there to the terminal version of 777

If someone could guide me though that, I'll scribble it down and never forget it!

I tried:

oliver-nourishs-mac-mini:/ oliver$ cd Applications/MAMP/htdocs/barbadoslettings
oliver-nourishs-mac-mini:barbadoslettings oliver$ chmod 777 ./
oliver-nourishs-mac-mini:barbadoslettings oliver$ cd images
oliver-nourishs-mac-mini:images oliver$ chmod 777 ./
oliver-nourishs-mac-mini:images oliver$ cd carhire
oliver-nourishs-mac-mini:carhire oliver$ chmod 777 ./
oliver-nourishs-mac-mini:carhire oliver$ 

in relation to the original answer, but my permissions still seem stuck.

share|improve this question
#cd to the root folder
cd /
#list folders
ls -al
#you will see "Applications" there ...
cd Applications/application_name/your/folder/and/subfolder
#you can autocomplete with <tab> for available folders
#when you are in the desired folder:
chmod 777 ./
#you can use -R option to chmod to apply it recursively
share|improve this answer
If any of the folders have spaces in the names, you either put a backslash in front of the space, or enclose the entire path in quotes ("). – KeithB Aug 24 '10 at 12:35
OK will try this and come back shortly – YsoL8 Aug 24 '10 at 12:51
what does recursive mean in context? – YsoL8 Aug 24 '10 at 12:57
See what I tried in the original question – YsoL8 Aug 24 '10 at 13:12
@YsoL8: Recursively means it will apply to every file and folder contained in the folder you're telling to change the permissions for. When you run ls -l in one of those folders it won't tell you the permissions of that folder. ls -la will - look for rwxrwxrwx before the single period where the filename is. – Chealion Aug 24 '10 at 14:34

Try using the symbolic options to chmod instead. You may find it more intuitive.

$ cd Applications/application_name/your/folder/and/subfolder
$ chmod -R a+rX .

Working backwards through the args to chmod:

  • . means use the current directory
  • a+rX means add (+) read permission (r) and execute/access permission (X) for all users (a). The capital X means only add execute permission if another user already has execute/access permission -- this will grant it to directories (x means access permission for directories). I don't think there's a numeric equivalent for capital X.
  • -R means do this recursively -- i.e. repeat for all subdirectories and subdirectories in those, etc

Note randomly making things 777 is generally bad idea. You're opening up files to be written or executed. Some files need to be writeable -- e.g. wordpress is easier to work with if the web server can update certain files.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .