-
Create a file with a specific size (this example is FILENAME - 1Giga size);
dd if=/dev/zero of=FILENAME bs=1 count=0 seek=1G
-
Encrypt the file;
sudo cryptsetup -y -v luksFormat FILENAME
-
Decrypt it and map it to a label for easier referencing;
sudo cryptsetup luksOpen /home/USER/FILENAME LABEL
-
Create a file system to store files (if needed install xfsprogs);
sudo mkfs.xfs /dev/mapper/LABEL
-
Create a mount point;
sudo mkdir /mnt/MOUNTPOINT
or if you want to create a symbolic lynkmkdir /home/USER/ORIGINAL_FOLDER
sudo ln -s /home/USER/ORIGINAL_FOLDER/ /mnt/MOUNTPOINT
-
Mount the file system;
sudo mount /dev/mapper/LABEL /mnt/MOUNTPOINT
sudo cryptsetup luksOpen /home/USER/FILENAME LABEL
sudo mount /dev/mapper/LABEL /mnt/MOUNTPOINT
The container is closed on shutingdown or rebooting the system, otherwise you should close it manually.
sudo cryptsetup luksClose LABEL
sudo umount /mnt/MOUNTPOINT
- If there is a problem trying to send files to the container, take a look at the ownership and permission:
sudo chown USER:GROUP /home/USER/ORIGINAL_FOLDER
- Create Containter - https://blog.canadianwebhosting.com/how-to-create-an-encrypted-container/
- Encrypt Containter - https://www.digitalocean.com/community/tutorials/how-to-create-an-encrypted-file-system-on-a-digitalocean-block-storage-volume
- Symbolic Links - https://www.howtogeek.com/287014/how-to-create-and-use-symbolic-links-aka-symlinks-on-linux/
- Ownership and Permission - https://linuxize.com/post/linux-chown-command/