0

Is it possible to separate /home/$USER for one particular user into a separate partition in Arch Linux x86_64 with the 4.19.31-1-lts kermel?

I want to encrypt one user's /home directory, but I prefer dm-crypt to eCryptfs for dm-crypt perceives a partition as a whole, so in theory reads data about 10 times faster. But encrypting all of /home would be a problem, for other users must enter the encryption key at every login, which means we can look at each other's data.

1

Log out as that user, proceed as root. Create said additional partition with fdisk or parted. Make temporary mountpoint for that partition, say /mnt/tempuser. Mount it to that mountpoint. Rsync /home/$USER to /mnt/tempuser/ and then mv /home/$USER /home/originaluser. Mkdir /home/$USER and chown it to said $USER

Now try logging in as $USER. su - $USER from that same root console for example. Should be enough to test if it worked or what went wrong. Fallback would be

umount /home/$USER ; mv /home/$USER /home/faileduser ; mv /home/originaluser /home/$USER

Then if all seems fine with logging in like that, add it to /etc/fstab so it gets mounted on boot, define mountpoint here as /home/$USER

  • Hi! Sorry, I didn't get the idea of mv'ing from /home/$USER to /home/originaluser and making directory for $USER, if it is already there. But as I found, everything's much simper by installing the base system as it is to root directory, then mounting new [LVM-]partition to /mnt/home/user, moving user files there, encrypting and smoothing the dough by adding entry to fstab? I Just didn't try out it yet. – chzzh Apr 3 at 0:06
  • No worries, it was just for backup, not ultra-necessary. One could have mounted new partition also on top of existing directory and deleted content of old one later if all works well. – erkko Apr 3 at 0:18

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.