Ask Different is a question and answer site for power users of Apple hardware and software. 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 trying to setup my mac mini as a secure git server, I'm following this very helpful blog post,

Now I get stuck at number 6 when i am trying to save changes I have made to the /etc/sshd_config file. I am logged in as my administrator account and can open the file correctly, when I try to save it I receive the following error:

The document “sshd_config” could not be saved. You don’t have permission.

To view or change permissions, select the item in the Finder and choose File > Get Info.

I have tried to change the permissions using chmod but I can't do this either. I also can't locate it using the finder to be able to change permissions using File > Get Info as suggested in the error message.

Does anyone have any idea how I can resolve this? Please help!

share|improve this question
up vote 8 down vote accepted

Using sudo on the open command doesn't do anything particularly useful -- the actual program still gets run under the user's regular identity. To solve this, make sure TextEdit isn't running, then do:

sudo /Applications/ &
open -a "TextEdit" /etc/sshd_config

The first command runs TextEdit as root; the second tells it to open the file. After this, you should be able to edit & save changes. When you're done, be sure to quit TextEdit (or it'll keep editing files as root).

Alternately, use TextWrangler (or its even-more-capable-but-not-free sibling, BBEdit). It handles saving files as root automatically, as well as having easy ways to edit invisible files. I much prefer it for editing config files and the like.

EDIT: Be sure to get the version of TextWrangler from the Bare Bones Software web site, not the version from the Mac App Store -- the App Store version has the save-as-root feature removed to comply with Apple's rules.

share|improve this answer
Fantastic, thanks! TextWrangler has done the job! :-D – MattStacey Jun 15 '11 at 20:43
I would have liked to vote up the answer but I don't have enough reputation on this site yet – MattStacey Jun 15 '11 at 20:45
+1 for TextWrangler ... great tool. – Peter Meyer Jan 6 '12 at 13:45

Your Answer


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.