50

If I have selected a good password and kept it secret, what is the point of encrypting my home directory, as a setup option with some flavors of Linux offer during setup?

Won't the Linux permissions keep unwanted eyes away from my stuff?

  • 52
    Encryption protects you from data leak when your disk is stolen. – Aria Aug 31 '16 at 20:57
  • 26
    Here is how to recover lost password in Linux. Why am I posting this? Because this is how you can gain access to any machine running Linux. Either if you're physically sat on it, if you've nicked or cloned the hard drive, or otherwise have access to the data on the disk. This takes 11 steps and it's actually relatively roundabout, you can "recover" a password to any account in fewer steps. If you just need access to the data, you don't even need that - mount the disk, browse as root, done. Your user password is irrelevant. – VLAZ Aug 31 '16 at 22:42
  • 2
    @Aria There is no need to steal the disk, just get access for an hour or two. – Nathaniel Suchy Sep 1 '16 at 11:25
  • 1
    @Vld, doesn't that make ruin the point of encrypting the home directory (as opposed to full-disk encryption)? Since someone can easily recover the home password and then decrypt home/user? – raphael Sep 1 '16 at 14:17
  • 4
    @raphael admin-like changes to the password will not re-encrypt the home directory: askubuntu.com/questions/33730/… you need to supply both the previous and the new password to get the auto-reencryption and consecutive access to all files. I don't know if there are ways around this, though. In general, it's probably safer to have a different password that decrypts the hard drive data. – VLAZ Sep 1 '16 at 14:26
105

The point is to protect against your disk being accessed outside of the OS.

Encryption is useful against attackers who have physical access to your computer. Without it, it would be trivial to read out the content of your home directory, for example by plugging in a live boot USB stick.

  • 38
    Or removing the HDD and plugging it into a different computer. – Jörg W Mittag Aug 31 '16 at 23:54
  • 26
    Or look at the disk's content using literally anything except the OS used to manage the permissions. – Kevin Sep 1 '16 at 8:10
  • 4
    @kevin or use the OS used to manage the permissions to reset the root password and then do whatever you like. – Jon Bentley Sep 2 '16 at 11:51
  • 1
    Or by rebooting with init=/bin/bash – tylerl Sep 4 '16 at 5:50
  • This does leave the rest of your system unencrypted, which would let an attacker modify the system to steal your password when you enter it, or copy your data once the home directory is mounted. – Alan Shutko Sep 4 '16 at 13:28
30

The Linux permissions only work on your own system. If you take the disk and put it in another computer, or just boot another OS on the same computer that can read your Linux partition you will plainly see that the permissions do not prevent you from accessing the content of your home directory.

  • 8
    Actually permissions work just fine between Linuxes. You still need root or same user id number to access the files, if permissions forbid that. So switching computers isn't the trick, the trick is to have root access, eg. after booting from USB stick. – hyde Sep 1 '16 at 5:42
  • 54
    @hyde Yeah, but the attacker has root on his/her Linux. – user253751 Sep 1 '16 at 7:07
14

In addition to answers, there are a few minor caveats that one must keep in mind about these encrypted configurations.

When you are not logged into your system, data in your home directory is not accessible in plain text. This, of course, is by design. This is what keeps an attacker from gaining access to your files. However, this means that:

  • Your cronjobs may not have access to your Home Directory
  • SSH public key authentication into your system also will not work, unless you put your public key somewhere outside of your home directory and symbolically link it to your unmounted $HOME/.ssh/authorized_keys.

You can put your authorized_keys directly in your unencrypted home directory by following these directions without the need for linking it anywhere else. https://bugs.launchpad.net/ubuntu/+source/openssh/+bug/362427/comments/12

3

If you are not using full-disk encryption you should utilize home directory encryption. Otherwise anyone with physical access to the computer can do out of os access.

If your attacker with physical access could remove the hard drive, connect to external reader, copy home directory, steal data, put hard drive back in the computer. Depending on what data you've stored in your home directory things can get pretty problematic.

Hope this gave you some insight...

2

The reason you encrypt your home directory is for security. As mentioned before, there are several pros and cons to encrypting your home directory, it is not something to take lightly. If you are going to the point of encrypting your home directory then you would also make the encryption password different than your login password. Each time the system boots you are asked for two passwords, your login password and your home directory encryption password. In this situation, if your drive or computer are stolen then the thief would not have access to your encrypted home directory. Even booting up the computer with a live system (cdrom/dvd/usb stick) would not allow the thief access to your encrypted home directory. All the thief would see is garbage on your home directory since they would not have the encryption password. Your login password would not help the thief in any way. Hope this helps.

  • Why should the passwords be different? – Ini Sep 19 '18 at 22:28
2

Encrypted home directory on a computer is supposed to be less accessible in the eventuality the computer or some of its parts are stolen or accessed without proper rights.

Encryption can be useful if you need to protect private or confidential information that you store in your home directory.

1

The answers (notably the one by tim) already answer the question about why you would like to encrypt the home directory. Yet, there is one caveat that no one talked about.

Encrypting only the home directory on Linux is poor security.

  1. Several applications store temporary files in /tmp and /var/run (or just /run which should be a soft link to /var/run). Therefore, although the home directory is protected, these temporary files are stored in plain text and a competent attacker will look into the temporary files.

    /tmp and /var/run (and /run) should be either encrypted as well, or be mounted as tmpfs (a filesystem in memory, but for this option read the next point).

  2. The swap is another place that applications may store a file in plain texts. The application will have the file in memory and the kernel may swap out the memory pages that contain the file (which is in plain text in memory). This also will happen with files in a tmpfs.

    If you have anything encrypted on a machine, you should always encrypt the swap as well. Otherwise a competent attacker can scan the swap partition for file signatures an d retrieve complete (or parts of) files in plain text.

If you have full disk encryption (on all disks of the system) these are not concerns.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.