3

This question was asked during an interview with Google and I can't find any answer.

I'm thinking of encrypting your home directory, but if anyone has done it before, i'd appreciate if you can share the knowledge.

3
  • 1
    This is not a complete answer, just a pointer to one approach: 1. Create an encrypted partition 2. Copy your home directory contents to that partition 3. purge all your home dir contents, except for a minimal shell script which mounts the encrypted partition over your home directory. This script should prompt for password during login. Note that the root user will still be able to access the encrypted data while you're logged in, but as long as you unmount when logging out, you're good the rest of the time.
    – Stabledog
    Jan 8, 2014 at 0:03
  • thanks @Stabledog for the pointer. But I think the interviewer wants is other privilege users must not be able to access my home directory as well. Seem like Peter's answer about SELinux is more appropriate for this scenario
    – everest
    Jan 8, 2014 at 3:05
  • Understood. I don't think the SElinux approach would work, at least not when a fully-skilled root user decides to bypass it. You would have to lock out root from basic things that root needs to be able to do, such as (for example) just swap out the kernel or unload kernel modules. The complexity of trying to harden the scheme against such challenges by a logged in, privileged, skilled user with shell access is very daunting.
    – Stabledog
    Jan 9, 2014 at 14:37

2 Answers 2

5

AFAIK SELinux gives you full control on what each user is supposed to do on your machine including the root user, removing the privilege of root users to change this access control policies should do the job.

7
  • Wow. I actually think this is correct answer on the question.
    – VL-80
    Jan 8, 2014 at 2:41
  • Thanks Peter. Unless another SELinux guru says otherwise, I believe this is the answer the interviewer was looking for. I wish I've thought about it before. Well, what can I say. Job hunting is a journey with a series of NO followed by one yes. :)
    – everest
    Jan 8, 2014 at 3:07
  • @everest yes, freelancing is a buiss where you got to be right-on-time ;)
    – Peter
    Jan 8, 2014 at 11:48
  • I don't believe that there is any way you could prevent a root user from whacking the SElinux policies in ways that he wants. To do that, there would have to be an impermeable separation between the SElinux roles and the Linux users, such that one could completely administer SElinux without any of the usual tools needed by root. I don't think it's possible, but SElinux is complex enough that one really does need to be an expert to say. I'm confident that the OP isn't yet at an SElinux skill set adequate for this, and this answer does not provide adequate guidance on that.
    – Stabledog
    Jan 9, 2014 at 14:29
  • As a practical matter, I think it's several orders of magnitude easier to just eliminate root logins for other users than it is to get a machine working with such a draconian SElinux policy that you've effectively locked out other root users from your account.
    – Stabledog
    Jan 9, 2014 at 14:31
1

I believe encryption is the only sure way to restrict access to files, since, as you mention, there is nothing preventing someone from physically removing an unencrypted drive and accessing it as root on another computer.

3
  • Do you have an idea of how runtime decryption will be happening? Because, if my home directory will be encrypted it should be decrypted (and mounted) every time I log in and should be unmounted and encrypted when I log off (or disconnect from SSH session in case of remote connection). In addition to that - root will be able to access my home directory while I logged in. How we go around it?
    – VL-80
    Jan 8, 2014 at 0:41
  • Okay I see your concern about root being able to access your data when it is mounted and unencrypted. For that, there is not much you can do since encryption will not protect from attackers gaining root access (or a rogue admin). If you are accessing a system for which you do not have root permission then it may not be a good idea to store your important personal files on it. The Arch Linux Wiki has a great article on this subject. Jan 8, 2014 at 1:34
  • Right. I do not know if what we discuss here even possible...
    – VL-80
    Jan 8, 2014 at 1:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .