I'm running 13.10 Saucy. If I didn't enable disk encryption during installation, is there any way to enable it post facto?
I found this, which says that encryption has to happen at install time, but it's also referring to Fedora. I can easily boot into a live disk if there's any way to do it from there.
If you want to enable encryption of your home folder you will need to install and use these packages:
ecryptfs-utils
andcryptsetup
. Also you will need another user account with administrator (sudo) privileges. The full documentation is here:If you want to enable full disk encryption after installation, the short answer for now is probably: no, you can't. Anyway, if you are interested about this, your question is duplicate of:
Encryption in
/home
is done using a user space filesystem called ecryptfs. It is very well done and tightly knitted into the default auth system so that you'll have zero usability drawbacks: when you enter your account (either from a remote shell or from the default login screen) your password is used to unwrap a secure key, which is then used to encrypt/decrypt your files in your home directory on the fly(The mounted filesystem will reside directly in/home/username
). When you log out /home/username is unmounted and only the encrypted files remain visible in the system (usually in/home/.ecryptfs/username/.Private/
). They look like a bunch of scrabbled/random files since filenames are encrypted as well. The only information leak is: filesize, timestamps and number of files (with full disk encryption these are hidden as well).If your system is to be shared between multiple users, this is a very nice feature to have even if you decide to add full disk encryption along with this: the safety of Full disk encryption is off when the machine is up and running while home (ecryptfs) encryption is On as long as you're logged out.
So, full disk encryption and home encryption are not necessarily mutually exclusive.
Here's a list of possible set-ups, depending on different security needs:
ecryptfs-migrate-home
. Also, this has been the default Ubuntu setup before it changed a few releases back, adding the possibility of full disk encryption. Since most modern desktops can handle full disk encryption without a sweat and it adds a thin layer of security against off-line code injection, full disk encryption was added into the installer. Notice though that for most users just encrypting their home with ecryptfs will be enough for their needs: keeping their friends and the common laptop thieves off their private data. Besides, if you've been singularly targeted by an organization with the right means, having full disk encryption or just home encryption will not make much of a difference unless you've also established a lot of other paranoid behaviors (like: keeping the kernel in a separate pen-drive which is always on you; constantly checking for hardware tampering/keyloggers and so on)Yes and it's going to be easier if you're currently using LVM and have enough space on your system to copy all of your unencrypted system files into an encrypted LUKS partition. I'm not going into the details at the moment because I don't know if you're using LVM and if you'd rather not just use ecrypfs for now and skip the hassle of full disk encryption until the next fresh installation.
As this is still the top result on google, I want to update it with some new information. As user Frederick Nord mentioned on: Is there a way to do full disk encryption after the install?
There is a tool called luksipc(Luks in place encryption) after further research I found the most recent documentation and a warning from the author of that tool:
So
cryptsetup-reencrypt
seems to be the recommended way.High Level Overview:
Short guide taken from Ubuntu Documentation :
Detailed guide taken from Arch Wiki - Encrypt an unencrypted filesystem :
Question: Why shrink to Minimum Size ?
Answer: Assumption - this is done because the size of the LUKS header can change in the future so this steps are generic and won't get out of date. The Header Size changed from LUKSv1 = 2MB to Luksv2 = 16MB in the past
Troubleshooting Guide - /boot is encrypted and I can't boot
Update 12/2020
So for me it happened that I only had 1 partition which included /boot. Afterwards I couldn't boot into my system anymore. If you experience the same issues, this guide might help getting back a working system.
High Level Overview
Grub
Initramfs
update-initramfs -u -k all
How to boot
Alternative
Maybe consider using this guide below instead . It seems to deal with the issues mentioned above. Though i haven't tried so I can't be sure it works. But might be worth looking into. https://cryptsetup-team.pages.debian.net/cryptsetup/encrypted-boot.html
P.S The troubleshooting guide was written from memory, so there might be some missing pieces. But i wanted to write it anyways as it still might help some people. However if you find something which is missing/inaccurate please tell me in the comments so i can update the guide thx.
Well, you could make a backup of all the important directories and installed software. Make sure your 13.10 is fully updated to avoid version conflicts. Usually the things do back up would be:
/boot
/etc
home
var
/usr/local
/bin
,/lib
,lib64
).After that you reinstall the system only now encrypted. Update it to the full extend. Then move the backup to the encrypted system and install all the software from the previous version.
Just be sure not to overwrite files important to the encryption, when putting back the back up (e.g.
/etc/fstab
,/etc/cryptab
, some grub related stuff and some stuff in/boot
should not be replaced with the backed up files).From a working Ubuntu 16.04, I succeeded in post-installation root partition encryption, with the root partition containing everything except /boot. I put /boot on a separate removable usb. Notably I did this before upgrading to Ubuntu 18, and the upgrade worked fine on the encrypted disk version.
The encryption was not done "in place", which was fine with me because I didn't want to overwrite the working version until the new setup was working, anyway.
Performing the correct procedure is extremely simple and fast. (Although figuring out the correct procedure was extremely time consuming because I followed some false leads.)
OUTLINE
DETAILS
1 - Boot with a live linux USB disk - it is convenient to have persistence enabled.
Installed Ubuntu 16 on a usb with unetbootin. The GUI allow "persistence" to be specified, but another step is also required to get the persistence to work - modify
/boot/grub/grub.cfg
to add--- persistent
as follows:Boot in with the live USB
2- Create a luks encrypted volume group on an empty partition. Create / (root) and swap logical volumes on that encrypted partition.
Assume the unused partition to be encrypted is
/dev/nvme0n1p4
.Optionally, if you have old data on the partition you want to hide before encryption and formatting, you might random wipe the partition. See discussion here.
Set up the encryption.
You'll be asked to set a password.
You'll be asked to enter the password. Note that
crypt1
is an arbitrary user decided name. Now create the volumes and format.Use these utilities to view the volumes and understand the hierarchy.
3- Copy files from old root to new root
cp -a ...
copies in archive mode, preserving all file modes and flags.4- Set up and partition another USB to act as the removable boot disk.
I used gparted for this. Set up two partitions. The first partition is
vfat
, the secondext2
. Each was 512 MB, you might get away with less. Assume device/dev/sdf
.5- Set up some files in the new root, do some magic, and chroot into the new root and then install grub onto the boot disk from the chroot'd new root environment.
Find some UUIDs for later use. Note the outputs from the following commands:
Mount the root partition and boot partitions
Setup the file
/mnt/etc/fstab
where "[uuid of ...]" is just a letter-number-hyphen combination.
Create the file
/mnt/etc/cryptab
Some magic required to enter the root directory environment:
Now set up the boot USB disk with
grub
:Now you should be able to reboot and bootup using the newly created USB boot disk.
Toubleshooting-
(a) The network must be connected for the
apt install --reinstall grub-efi-amd64
command. If the network is connected but DNS is failing, try(b) Before calling
initramfs
, the currentvmlinuz...
file used in the original linux must be present in the new root directory. If it isn't, find it and place it there.(c) The
grub-install
command will by default search all other linux disks it can find even if they are notmount
ed, and put them in the boot menu on the new boot USB. Usually this is not desired, so it can be avoided by adding this line to/boot/default/grub.cfg
:NOTE: A text file with the encryption key can be added to the removable boot USB.
Simple answer: No.
Complicated answer:
Encrypting a disk or partition will erase everything currently on that disk or partition, so to encrypt a disk you also should remove the contents of the disk. You should make appropriate data backups prior to starting. Obviously, this means that you should reinstall the system to use full disk encryption, no other way around. This is because random data will be written over the entire disk to make more difficult the recovering of the data.
But, nowadays you don't need to encrypt your root partition. Remember that if something goes wire you are out of your system without possibilities to recover the data. You should consider only encrypt your personal information instead.
See related question How to encrypt full disk after installing?