Tell me more ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I'd like to password protect a text file. Not necessarily a .txt file - just a file that's got text in it that I can edit with a standard text editor. I'd like to set a password and be prompted for it every time I open the file in any app. What's the best way?

share|improve this question

2 Answers

up vote 8 down vote accepted

You can put the file into an encrypted disk image.

  1. Open "/Applications/Utilities/Disk Utility"
  2. File > New > New Blank Image...
  3. In the new image dialog make sure to choose:

    • Encryption = 128 or 256-bit AES
    • Image Format = read/write disk image
  4. Because you chose encryption, you will be prompted to set a password for the disk image

You now have a password-protected disk image that you can save any kind of file in.

share|improve this answer
Brilliant and simple. Thank you! – Abby T. Miller Dec 31 '11 at 20:09

Assuming you're the file's owner, a built-in and system-wide way to do this would be to adjust the file's permissions so that only a specific user or users (I'm assuming you want to lock the file so only you can view/edit it) can read or write to the file.

As Mark pointed out in the comments, however, this only protects you if:

  • No other user has admin rights to the machine, and
  • No one gains access to the machine while you're logged in

Making Coconut Man's solution by far a better one. I'll leave this answer here as an alternative that may be helpful in similar situations.

share|improve this answer
Even then anyone with admin rights or physical access to the machine can read the file (+ you need to be aware of how backups store the data) – Mark Dec 31 '11 at 14:24
Good point! I'll edit my answer to describe it as an alternative with said limitations. – Dan J Dec 31 '11 at 23:03

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.