GPGDIR(1)

NAME
gpgdir

SYNOPSIS
gpgdir [-e directory ] [-d directory ] [-g directory ] [-p pw-file ] [--Exclude pattern ] [--Exclude-from file ] [--Include pattern ] [--Include-from file ] [-K Key-ID ] [-D] [--no-recurse] [--no-delete] [--no-preserve-times] [-t] [-s] [-q] [-V] [-v] [-h]

DESCRIPTION
gpgdir is a perl script that uses the CPAN GnuPG::Interface perl module to encrypt and decrypt directories using a gpg key specified in ~/.gpgdirrc. gpgdir recursively descends through a directory in order to make sure it encrypts or decrypts every file in a directory and all of its subdirectories. By default the mtime and atime values of all files will be preserved upon encryption and decryption (this can be disabled with the --no-preserve-times option). Note that in --encrypt mode, gpgdir will delete the original files that it successfully encrypts (unless the --no-delete option is given). However, upon startup gpgdir first asks for a the decryption password to be sure that a dummy file can successfully be encrypted and decrypted. The initial test can be disabled with the --skip-test option so that a directory can easily be encrypted without having to also specify a password (this is consistent with gpg behavior). Also, note that gpgdir is careful not encrypt hidden files and directories. After all, you probably don't want your ~/.gnupg directory or ~/.bashrc file to be encrypted.

OPTIONS

-e, --encrypt <directory>
    Encrypt the directory specified on the command line.

-d, --decrypt <directory>
    Decrypt the directory specified on the command line.

-g, --gnupg-dir <directory>
    Specify which .gnupg directory will be used to find GnuPG keys. The default is ~/.gnupg if this option is not used. This option allows gpgdir to be run as one user but use the keys of another user (assuming permissions are setup correctly, etc.).

-p, --pw-file <pw-file>
    Read decryption password from pw-file instead of typing it on the command line.

-t, --test-mode
    Run an encryption and decryption test against a dummy file and exit. This test is always run by default in both --encrypt and --decrypt mode.

--Exclude <pattern>
    Instruct gpgdir to skip all files that match pattern as a regex match against each filename. This is similar to the --exclude option in the standard GNU tar command.

--Exclude-from <file>
    Instruct gpgdir to exclude all files matched by patterns listed in file. This is similar to the --exclude-from the GNU tar command.

--Include <pattern>
    Instruct gpgdir to only include files that match pattern as a regex match against each filename.

--Include-from <file>
    Instruct gpgdir to only include files matched by patterns listed in file.

-K, --Key-id <id>
    Manually specify a GnuPG key ID from the command line. Because GnuPG supports matching keys with a string, id does not strictly have to be a key ID; it can be a string that uniquely matches a key in the GnuPG key ring.

-D, --Default-key
    Use the key that GnuPG defines as the default, i.e. the key that is specified by the default-key variable in ~/.gnupg/options. If the default-key variable is not defined within ~/.gnupg/options, then GnuPG tries to use the first suitable key on its key ring (the initial encrypt/decrypt test makes sure that the user knows the corresponding password for the key).

--skip-test
    Skip encryption and decryption test. This will allow gpgdir to be used to encrypt a directory without specifying a password (which normally gets used in encryption mode to test to make sure decryption against a dummy file works properly).

-q, --quiet
    Print as little as possible to the screen when encrypting or decrypting a directory.

--no-recurse
    Instruct gpgdir to not recurse through any subdirectories of the directory that is being encrypted or decrypted.

--no-delete
    Instruct gpgdir to not delete original files at encrypt time.

--no-preservetimes
    Instruct gpgdir to not preserve original file mtime and atime values upon encryption or decryption.

-v, --verbose
    Run in verbose mode.

-V, --Version
    Print version number and exit.

-h, --help
    Print usage information and exit.

FILES
~/.gpgdirrc
    Contains the key id of the user gpg key that will be used to encrypt or decrypt the files within a directory.

EXAMPLES
The following examples illustrate the command line arguments that could be supplied to gpgdir in a few situations:

To encrypt a directory:

$ gpgdir -e ~/testdir

To encrypt a directory with the default GnuPG key defined in ~/.gnupg/options:

$ gpgdir -e ~/testdir --Default-key

To decrypt a directory with a key specified in ~/.gpgdirrc:

$ gpgdir -d ~/testdir

To encrypt a directory but skip all filenames that contain the string "host":

$ gpgdir -e ~/testdir --Exclude host

To encrypt a directory but only encrypt those files that contain the string "passwd":

$ gpgdir -e ~/testdir --Include passwd

To encrypt a directory but skip the encryption/decryption test (so you will not be prompted for a decryption password):

$ gpgdir -e ~/testdir -s

To encrypt a directory and no subdirectories:

$ gpgdir -e /home/user/testdir --no-recurse

To encrypt root's home directory, but use the GnuPG keys associated with the user "bob":

# gpgdir -e /root -g /home/bob/.gnupg

DEPENDENCIES
gpgdir requires that gpg, the Gnu Privacy Guard (http://www.gnupg.org) is installed. gpgdir also requires the GnuPG::Interface perl module from CPAN, but it is bundled with gpgdir and is installed in /usr/lib/gpgdir at install-time so it does not pollute the system perl library tree.

SEE ALSO
gpg(1)

AUTHOR
Michael Rash <mbr@cipherdyne.org>

BUGS
Send bug reports to mbr@cipherdyne.org. Suggestions and/or comments are always welcome as well.

DISTRIBUTION
gpgdir is distributed under the GNU General Public License (GPL), and the latest version may be downloaded from http://www.cipherdyne.org