Let us imagine I have encrypted my tar file with gpg as we can see here but I want to mount that with archivemount (e.g.: answer) without holding the unencrypted file on disk. Is it possible?

If not, Is there some way to create a encrypted disk image as a file to mount like we can see on EncryptedFilesystems?

1 Answer 1


No, archivemount can’t do that. It doesn’t support GPG and neither does it support external filters/helpers.

LUKS works perfectly fine with file containers, using losetup and loop devices:

truncate -s 1G container.img
losetup -f # Use output in next commands
losetup /dev/loopX container.img
cryptsetup luksFormat /dev/loopX
cryptsetup luksOpen /dev/loopX mycontainer # ...where “mycontainer” is a free name in /dev/mapper/

Then proceed to create a filesystem and whatnot. When you’ve finished using the container, close it:

cryptsetup luksClose /dev/mapper/mycontainer

And remove the loop device mapping.

losetup -d /dev/loopX
  • It took me a time to format, It's better to use luksformat -t ext4 /dev/loopX instead of cryptsetup luksFormat /dev/loopX. Jun 11, 2015 at 20:55
  • This solution has a major drawback: It requires one to be able to get superuser privileges.
    – dirdi
    Mar 16, 2020 at 12:35

You must log in to answer this question.

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