Ask OS X Daily: “How can I password protect a file?”
Hello all you loyal OS X Daily readers! Recently we have been receiving a large number of Mac OS X related questions in our inbox. Normally our staff would try and respond with an answer to the best of our knowledge. However, sometimes we get a question we think would be better sourced to the wisdom of our brilliant readers, and this one in particular we think would be fun to run some of these by the many regulars who stop by the site. We’ll offer a few of our own suggestions for password protecting various elements of a Mac, but please help us with the following question and give your own opinions:
Greg Simon writes in the following question:
“First off, I’ve enjoyed the numerous tips and tricks posted by the knowledgeable folks at OS X Daily. I have something I think you guys might be able to help me with. Recently I found myself writing a journal, and as such I really want to find a way to password protect it so my inner thoughts don’t end up in the hands of the wrong person. Multiple people use my laptop and its not a good feeling knowing that anyone could just double click my text file of emotion and find out everything about me! All I’m looking for is a way to encrypt a file on a file-by-file basis, do you guys have any suggestions?”
So, the question is “How can I password protect a file?” specifically in a potentially multi-user environment?
Do you have a great answer for this? Review our selection below, but let us know your own thoughts by leaving a comment below.
We at OSXDaily have covered a variety of security tricks that may work specifically for this purpose, here are a few of our articles addressing the password protection of files, documents, and even the encryption of an entire hard drive or computer:
- How to use FileVault full disk encryption to protect the Mac and all it’s files
- Password locking a text file with ‘vi’ at the command line
- Placing a password onto a zip archive
- How to encrypt an entire folder in Mac OS X
Are these sufficient for Greg’s question?
There are already a lot of excellent recommendations in our comments as well, don’t miss reading through our excellent user submissions below to see other ideas on how to protect data or a specific file on the Mac.
And, of course, if you know of a specific method not described here or in the user submissions below, don’t forget to let us know your own tricks and personal password protection methods by leaving a comment yourself! We’ll all appreciate it. Feel free to continue to email us with any Mac OS X related questions!
Hi,
I have protected a microsoft word file, but lost the password.
Is it possible to remove the password in Terminal?
Thanks.
So far as I can tell (and forgive me if the answer is in one of the apps linked to above, as I haven’t yet tried them), it’s basically a choice between poor security while still being able to edit the file (MS Word, iWord, etc.) or much better security, but a pain to edit an re-encrypt. Anyone out there find a solution that allows editing (with password, of course) and re-saving encrypted file without having to go through the whole disk image or terminal process again?
Thanks!
Thank you James Gregory.. I have been searching this for years and you just gave me the tip: zip -e
If you have word for Mac, then when you click save as, click options..but you wont get the side bar like other sites tell you. click the little buton that looks like the word sign and there will be an option for security. just type in a password and your done
sorry didnt read last comment
WARNING – There was an earlier suggestion to use the “save with password” option when using MS Word. This is NOT secure and can be cracked in 5 minutes using any one of numerous shareware apps designed to specifically crack the Word password!
Thanks for all the tips. Very helpful. I LOVE my Mac, but the fact that I can’t just right click on a folder and choose set password is just plain stupid.
Please reply the answere in 5 min to my gmail. The main problem is I want to set the password for folder not to the zip how to set the password for folder to use terminal commands or deb file.
Encrypt the file using Terminal. No downloads necessary. It is built into the Mac. The encryption is done using a zip compression. In order to open the zip file, it requires a password, and there is no way around it. If you forget the password, the contents of that file will be lost. However, if you need to edit the contents of the file, you will have to save it and then create a new encrypted zip file.
See http://www.youtube.com/watch?v=TS1LSBZAii8&feature=channel
Open Terminal from /Applications/Utilities/
To learn how to zip in Terminal
-Type: man zip
-press return
-use arrow keys to move up and down to read the article
-press Q when done to quit the man page
Here are the basics of creating an encrypted zip file:
1. Navigate to your folder that contains the item you want to encrypt
-Type: cd
-press return
2. Zip the file in the folder that you want to encrypt and password protect
-Type: zip -e ./.zip ./
-press return
-remember to include the extension of the file(s) you are going to put in the zip
-remember that capitalization matters in Terminal
-if you use spaces, put the file name or folder name in quotations (/Users/”this is an example”/Documents/)
3. Terminal will ask for the password
-enter it carefully and press return (note that it will appear that nothing is happening)
-enter it again carefully and press return (note that it will appear that nothing is happening)
4. The encrypted zip will be created, and, if you double-click on it, it will tell you that it could not unarchive the zip file because the “Operation not [was] not permitted.”
5. To unarchive the file and open it successfully, you must also use Terminal
Here are the basics of unzipping an encrypted zip file:
1. Navigate to your folder that contains the item you want to unzip
-Type: cd
-press return
2. Unzip the zip file
-Type: unzip .zip
-press return
3. Enter the password (note that it will appear that nothing is happening) and press return
4. The zip is now unzipped and accessible
Example:
I have a sensitive RTF document on my Desktop that I want to password protect, and it is called zipme.rtf.
Open Terminal
Type: cd Desktop/
Press Return
Type: zip -e ./zipme.zip ./zipme.rtf
Press Return
Enter Password
Press Return
Confirm Password
Press Return
I then delete the original zipme.rtf (you may want to verify that the zip worked first by continuing with the next step before deleting the original, but you may want to relocate the original momentarily to your ~/Documents/) to prevent the original from being opened, since it is not secured with a password like the encrypted zip file is secured.
I now want to open my zip file.
Open Terminal
Type: cd Desktop/
Press Return
Type: unzip zipme.rtf
Press Return
Enter Password
Press Return
Done
typo in the example for opening the zip file
“Type: unzip zipme.rtf” is incorrect, and it should read, “Type: unzip zipme.zip”
Actually, the zip encryption algorithm has many known vulnerabilities, and is relatively easy to crack, particularly if the password you select isn’t particularly good. Winzip (there is a mac version!) uses AES encryption, which (at least for the moment) has no known vulnerabilities. I’d go with winzip.
I like this method the most. I don’t like having a third party app/widget just hiding and showing the file by adding a ‘.’ to the beginning of it or using it’s own method of securing it. Thanks for sharing!
what about a secure note in keychain?
I know this post is WAAAAY old but it comes up pretty early on via Google search. via YouTube I found out a great way to do this.. the program you download is called LameSecure (link below)
http://mac.softpedia.com/progDownload/LameSecure-Download-27445.html
I don’t know about y’all but this is EXACTLY what I was looking for. Set the password up using LameSecure, then it turns your file into a .app, requiring a password to open it up. Great app, kudos to those who created/developed
Comment to SS.. Your solution works great! Nothing extra to download. THANKS!
This is easy. Get Info on the file, uncheck Hide Extension, then close Get Info, and rename the file with a different extension. The system will ask if your sure?, say yes, you’re done.
In your case, change .docx or whatever to .jpg or whatever. If people try to open the file, it wont work.
With this method there’s no need to download widgets or programs. All you have to do is remember the original dot extension.
I found this really helpful! Thanks guys!!
[…] Read this… although a bit dated, has some good ideas. Ask OS X Daily: “How can I password protect a file?” – OS X Daily Regards. […]
Here is a widget that actually hides files and folders from both spotlight and finder. Just drag said file into the magic hat, add a password, and you are done. See this site for more details: http://www.dashboardwidgets.com/showcase/details.php?wid=1410
Now here is an idea that i am just trying. Launch keychain access (in the utilities folder) Go to the File menu and then New Keychain name it give it a password (not your login password) and then right click on it when it shows up in the side bar click on Change Settings and make sure it is set to automatically lock. Now you can add a new secure note item and others cannot access it without your password.
Just use OpenSSL like shown here: http://snippets.dzone.com/posts/show/341
Sorry. typo in the last post, poor proofreading. “Microsoft Word of NeoOffice” should read “Microsoft Word OR NeoOffice”
I too have looked for a way to do this, but have not been able to find one. There really is no straight forward way to do this in OS X. I did find at one point, a third party app that let you set a password then would hide and unhide the files you told it too when you opened it and entered the password, but the program was poorly designed and did not function well. So here are a few simpler options.
If your journal is typed in Microsoft Word of NeoOffice Writer, then you can save the document with a password. In Word click Options… in the save dialogue then enter a password there. In Writer, click Save As… then click the “Save with Password” checkbox. I do not know if that helps at all.
Also, if you are not using a word file, or even if you are but wanted further protection, then you could change the file permissions either in “Get info” or from the terminal, so that it the file could only be read when you are signed in under your own username, or with root privileges. To do this, you would open the “Get Info Dialogue,” scroll down to Permissions, then change everything but “Owner” to “No Access.” You may need to enter your password at some point. However, this would only help if all the users of your laptop use different usernames and passwords.
Finally, this will not password protect your file, but you could hide the file from prying eyes by opening the terminal, navigating to the directory in which your journal is stored, and renaming the file with a “.” before it. The command to rename is mv. For example:
mv MyJournal.txt .MyJournal.txt
would do the trick, obviously replacing “MyJournal.txt” with the name of your file. Then, just issue the reverse command to get it back when you would like to edit it:
mv .MyJournal.txt MyJournal.txt
You can also combine any or all of these three tricks for added security. Bear in mind that none of these methods actually encrypt your data, they just lock people out of it or hide it. For encryption, your best bet is the encrypted disk image mentioned above.
thanks for the Microsoft Word tip
simple and exactly what I was looking for
great q
As others have already suggested, I use an Encrypted Disk Image. It may not be exactly what you were looking for; however, it may be easier to have a single “my disk” which is encrypted.
Sorry, here’s the “live” link:
http://www.dekorte.com/projects/shareware/Crypt/
Encrypted Disk Image is the best “native” way. Besides, I personally use Crypt (http://www.dekorte.com/projects/shareware/Crypt/) simple and tough.
Thank you for the post! The crypt software works simply and beautifully. Your suggestion was a great help!
I have been using a dashboard widget “DashCrypt” to do this task. For most things it works well……
http://www.dashboardwidgets.com/showcase/details.php?wid=588
+1
OS X does have some encryption stuff in disk images..
Thats not exactly on a file-by-file basis, but still – you could create a disk image at a certain size encrypt and password protect it and keep all your “secret” stuff there, and you wouldn’t have to look for 3rd party software to do the job ..
Hi there,
you could write in Vim and encrypt the file via the :X command. Plain and simple.