I am looking for a tool to encrypt/decrypt the contents of a directory
recursively. Looking around, people mention gpgdir. The thing is, this
is a Perl-based tool, and after having been burnt by third-party Perl
tools before, I'd prefer to use something else. Thus, if there is
something out there that people might know about, I'd like to know.
Hello,
I have taken a different approach to the problem of encryption.
Initially, like you I tried encrypting locally--within a file system. I
found that frustratingly difficult. And also dangerous: Everytime you
encrypt something you run the risk of losing it, *and* you have one more
passphrase to keep track of.
So I tried instead using the cryptsetup command to make, open and close
LUKS encrypted partitions. This took a little work to get going, but it
was well worth the effort. To do this I made a set of scripts:
luksetup
crypt
ucrypt
lksmnt
ulksmnt
Script luksetup makes $1 into a LUKS encrypted partition (and destroys
any existing file system). To do this it prompts you for a passphrase.
Here is the script:
cryptsetup \
--verbose \
--cipher aes-xts-plain64 \
--key-size 256 \
--hash sha256 \
--iter-time 1000 \
--use-urandom luksFormat $1
You will need to run scripts crypt and ucrypt directly only
occasionally. For example you will need them after running luksetup to
make a new file system on the LUKS encrypted partition. Script crypt
will prompt you for the passphrase. Here is an example:
crypt /dev/sda1 bob
mke2fs /dev/mapper/bob
ucrypt bob
Scripts lksmnt and ulksmnt do the mounting and un-mounting of a LUKS
encrypted partition. They call scripts crypt and ucrypt. Here is an
example:
lksmnt /dev/sda1 /mnt/hd bob
<Do what you need to do to /mnt/hd.>
ulksmnt bob
I'll quit here without giving the text of scripts crypt, ucrypt, lksmnt
and ulksmnt. They are, however, short one and two line scripts that use
only the commands and scripts I have named here. I'll leave them as a
puzzle for you, but let me know if you need help.
-Joe