Answers to: encrypting file or all data on hard drivehttp://linuxexchange.org/questions/227/encrypting-file-or-all-data-on-hard-drive<p>I wish to encrypt certain files or even better all data files that I create and download to my Ubuntu laptop in order to protect them from unauthorized users. What are my options? What are problems to watch out for? Is there any program that will encrypt/decrypt everything going in and out of specific directories on the hard disk transparently?</p>enMon, 24 May 2010 22:03:44 -0400Answer by tallshiphttp://linuxexchange.org/questions/227/encrypting-file-or-all-data-on-hard-drive/697<p>All of the above answers are great! </p> <p>But all you really have to do is:</p> <blockquote> <pre><code>$ chmod -Rv 400 ~/.privdata </code></pre> </blockquote> <p>Where <strong>.privdata</strong> is the <em>hidden</em> directory tree you are concerned with(Hiding the directory only serves the "out of sight, out of mind" aspect, but every little bit of obfuscation adds <em>some</em> extra layer of security). </p> <p>That leaves only one user to concern yourself with, and that's the Superuser - if that's you, then:</p> <blockquote> <pre><code># chmod -Rv 400 /root/.privdata </code></pre> </blockquote> <p>Should fix everything up nicely, without having to even worry about ecrypting the data since it is now inaccessible unless you get <strong>0wn3d</strong> by a <strong>h4x0r</strong>, but there's more ;)</p> <p>Regardless of which methodology (or combination thereof) you choose (and you may want to mix for example, <strong>gpgdir</strong> or <strong>truecrypt</strong> with the methodology I've just provided you with), there's an often forgotten goodie that I regularly use <strong>(DO NOT FORGET THAT YOU HAVE DONE THIS)</strong> to make the file completely immutable:</p> <blockquote> <pre><code>$ man chattr </code></pre> </blockquote> <p>Be careful with this - it is only for the most paranoid and it is akin to <em>hard-coding</em> data on your hard drive - so again, if you use it, <em>don't forget that you have</em>.</p> <p>I hope that helps!</p> <p>Kindest regards,</p> <p>Bradley <a href="http://NorthTech.US" rel="nofollow">http://NorthTech.US</a></p> <p>.</p>tallshipMon, 24 May 2010 22:03:44 -0400http://linuxexchange.org/questions/227/encrypting-file-or-all-data-on-hard-drive/697Answer by Randy 2http://linuxexchange.org/questions/227/encrypting-file-or-all-data-on-hard-drive/678<p>Ron, thanks for the informative post. I was considering encrypting my home directory with TrueCrypt, but now I don't see the point.</p>Randy 2Fri, 21 May 2010 14:51:28 -0400http://linuxexchange.org/questions/227/encrypting-file-or-all-data-on-hard-drive/678Answer by Ronhttp://linuxexchange.org/questions/227/encrypting-file-or-all-data-on-hard-drive/480<p>To those using TrueCrypt, Google "Evil Maid Attack" (no quotation marks).</p>RonTue, 11 May 2010 19:20:25 -0400http://linuxexchange.org/questions/227/encrypting-file-or-all-data-on-hard-drive/480Answer by Garethhttp://linuxexchange.org/questions/227/encrypting-file-or-all-data-on-hard-drive/464<p>Well, with Ubuntu, you actually have the option on installing the operating system (since 9.10) to have your home directory always encrypted. This means that all data saved in your /home/username directory is unreadable by anyone. Ubuntu will automatically un-encrypt your home directory when you log in and re-encrypt when you log out.</p> <p>(In technical terms, your data is actually stored as a mountable image in an encrypted format. When you login your encrypted data is mounted to be immediately accessible, so if you log out or lose power or whatever, your data is still encrypted because it needs to be remounted on boot each time which is a quick and relatively painless task for the OS to do)</p>GarethTue, 11 May 2010 08:58:01 -0400http://linuxexchange.org/questions/227/encrypting-file-or-all-data-on-hard-drive/464Answer by maxhttp://linuxexchange.org/questions/227/encrypting-file-or-all-data-on-hard-drive/373<p>use gpgdir does a very good job; google "gpgdir" </p>maxFri, 07 May 2010 17:38:08 -0400http://linuxexchange.org/questions/227/encrypting-file-or-all-data-on-hard-drive/373Answer by carlicuslinuxhttp://linuxexchange.org/questions/227/encrypting-file-or-all-data-on-hard-drive/281<p>I have been using TrueCrypt as well for a few months and it works great.</p>carlicuslinuxTue, 04 May 2010 19:22:51 -0400http://linuxexchange.org/questions/227/encrypting-file-or-all-data-on-hard-drive/281Answer by mithrandir9xhttp://linuxexchange.org/questions/227/encrypting-file-or-all-data-on-hard-drive/275<p>I've been using truecrypt for quite some time now, without issue. Both whole drives and individual directories and easy to use. Even on windows machines.</p>mithrandir9xTue, 04 May 2010 16:35:00 -0400http://linuxexchange.org/questions/227/encrypting-file-or-all-data-on-hard-drive/275Answer by Tom Funkehttp://linuxexchange.org/questions/227/encrypting-file-or-all-data-on-hard-drive/263<p>You can use encrypted filesystem with LUKS (cryptosetup).</p> <p><a href="http://code.google.com/p/cryptsetup/" rel="nofollow">http://code.google.com/p/cryptsetup/</a></p> <p>or google for "cryptsetup luks howto"</p> <p>advantage: built-in in kernel</p> <p>you can encrypt containers too (loop device)</p>Tom FunkeTue, 04 May 2010 13:13:33 -0400http://linuxexchange.org/questions/227/encrypting-file-or-all-data-on-hard-drive/263Answer by feinomhttp://linuxexchange.org/questions/227/encrypting-file-or-all-data-on-hard-drive/246<p>You can use TrueCrypt or EncFS for this as well.</p> <p>TrueCrypt: <a href="http://www.truecrypt.org/" rel="nofollow">http://www.truecrypt.org/</a></p> <p>EncFS: <a href="http://www.arg0.net/encfs" rel="nofollow">http://www.arg0.net/encfs</a></p> <p>I'm sure there are lots of tutorials available for both :)</p>feinomTue, 04 May 2010 04:39:45 -0400http://linuxexchange.org/questions/227/encrypting-file-or-all-data-on-hard-drive/246Answer by Jubhttp://linuxexchange.org/questions/227/encrypting-file-or-all-data-on-hard-drive/231<p>Well to encrypt a single file, you can use gpg:</p> <pre><code>$ gpg -c filename </code></pre> <p>It should then prompt for a passphrase or password for it. Though, to encrypt entire directories, I think you may have to compress it first.</p> <p>The quickest way I can think of that'll encrypt files as you place them in a directory is writing a script that is constantly waiting for new files to be placed in said directory, and it then encrypts it and continues to wait for more. But that method would probably be pretty process heavy for a simple directory that encrypts files as they're placed in.</p>JubTue, 04 May 2010 02:50:49 -0400http://linuxexchange.org/questions/227/encrypting-file-or-all-data-on-hard-drive/231