Can I easily have an encrypted home in WSL?

_s10e@feddit.de to Linux@lemmy.ml – 20 points –

As a long-term Linux user, I tried running Ubuntu under the Windows Subsystem for Linux. I works!

I have tried to setup ecryptfs, but this fails complaining that kernel module is missing. Here I don't know enough about WSL, but it appears to come with a custom kernel.

Can I essily encrypt WSL? If Luks is the answer, how do I enter the passphrase? The boot process is hidden.

7

For the easy option / question - do you have bitlocker enabled? That’s not enough?

Do you want the encrypted folder to be automatically-unlocked or unlocked with a password

You can build your own Linux kernel for WSL, I haven’t done it and unless that sounds like fun to you that’s not the route I’d go.

Not sure if the Linux crowd can answer this Windows question.

I've read that systemd-homed can do encrypted home directories but I haven't tried it, much less on WSL but that may get you to achieve the encrypted home directory at least.

Personally I don't think I would have a need to encrypt all of WSL, but maybe that also makes sense for your case.

ArchWiki example: https://wiki.archlinux.org/title/Systemd-homed

Would it not be encrypted if you just encrypt your windows drive with bitlocker? Seems kinda redundant to double encrypt to me

I think this might be possible with WSL2, which is more of a VM type instance, but WSL1 has issues with kernel modules and some networking stuff due to how it integrates with Windows

Yes.

You'll just boot up into a blank home folder and a completely uncustomized bash (or whatever your default shell is).

After mounting you'll have to restart your shell or source your .${SHELL}rc