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?


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
|improve this answer|||||
  • It took me a time to format, It's better to use luksformat -t ext4 /dev/loopX instead of cryptsetup luksFormat /dev/loopX. – Tiago Pimenta Jun 11 '15 at 20:55
  • This solution has a major drawback: It requires one to be able to get superuser privileges. – dirdi Mar 16 at 12:35

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.