GPGDIR(1)
π GPGDIR(1) β the manual, but make it cute π
okay bestie, welcome to the gpgdir page from the General Commands Manual. this is the one that turns whole directories into locked little vaults. buckle up, we're going deep π
β¨ NAME β¨
gpgdir β recursive directory encryption with GnuPG
πΈ SYNOPSIS πΈ
gpgdir -e|-d <directory> [options]
π¦ DESCRIPTION π¦
so gpgdir is a perl script (yes, perl, she's vintage and she ate) that uses the CPAN GnuPG::Interface perl module to recursively encrypt and decrypt directories using gpg. she literally walks down through a directory so that every single file in it, and in all of its subdirectories, gets encrypted or decrypted. no file left behind, periodt.
by default the mtime and atime values of all files will be preserved upon encryption and decryption (you can turn this off with the --no-preserve-times option). also important, bestie: in --encrypt mode, gpgdir will delete the original files that it successfully encrypts (unless you pass the --no-delete option). so yeah, she's thorough like that.
but wait, upon startup gpgdir first asks for a the decryption password to be sure that a dummy file can successfully be encrypted and decrypted. like a little vibe check before the main event. that 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. and honestly? iconic of her. after all, you probably don't want your ~/.gnupg directory or ~/.bashrc file to be encrypted. imagine π
the key gpgdir uses to encrypt/decrypt a directory is specified in ~/.gpgdirrc.
finally, gpgdir can use the wipe program with the --Wipe command line option to securely delete the original unencrypted files after they have been successfully encrypted. this elevates the security stance of gpgdir since it is more difficult to recover the unencrypted data associated with files from the filesystem after they are encrypted (unlink() does not erase data blocks even though a file is removed). so like, the data blocks are still lurking under the bed unless you wipe. scary fr fr π
π OPTIONS π
-e,--encrypt <directory>β recursively encrypt all files in the directory specified on the command line. all original files will be deleted (a password check is performed first to make sure that the correct password to unlock the private GnuPG key is known to the user). yes, she checks your ID at the door π-d,--decrypt <directory>β recursively decrypt all files in the directory specified on the command line. the encrypted.gpgversion of each file will be deleted.--sign <directory>β recursively sign all files in the directory specified on the command line. for each file, a detached.ascsignature will be created.--verify <directory>β recursively verify all.ascsignatures for files in the directory specified on the command line.-g,--gnupg-dir <directory>β specify which.gnupgdirectory will be used to find GnuPG keys. the default is~/.gnupgif this option is not used. this option allowsgpgdirto be run as one user but use the keys of another user (assuming permissions are setup correctly, etc.). borrowing someone else's keys, lowkey slay π-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--encryptand--decryptmode.-S,--Symmetricβ instructgpgdirto encrypt to decrypt files using a symmetric cipher supported by GnuPG (CAST5is commonly used). this results in a significant speed up for the encryption/decryption process. zoom zoom β‘-T,--Trial-runβ show what encrypt/decrypt actions would take place without actually doing them. the filesystem is not changed in any way in this mode. window shopping, no cap ποΈ-I,--Interactiveβ prompt the user before actually encrypting or decrypting each file. this is useful to have fine-grained control overgpgdiroperations as it recurses through a directory structure. main character energy: you make every call π-F,--Forceβ tellgpgdirto ignore non-fatal error conditions, such as the inability to encrypt or decrypt individual files because of permissions errors. she's choosing peace π§--Exclude <pattern>β instructgpgdirto skip all files that match pattern as a regex match against each filename. this is similar to the--excludeoption in the standard GNUtarcommand.--Exclude-from <file>β instructgpgdirto exclude all files matched by patterns listed in file. this is similar to the--exclude-fromthe GNUtarcommand.--Include <pattern>β instructgpgdirto only include files that match pattern as a regex match against each filename.--Include-from <file>β instructgpgdirto only include files matched by patterns listed in file.-W,--Wipeβ use thewipeprogram to securely delete files after they have been successfully encrypted.-O,--Obfuscate-filenameβ tellgpgdirto obfuscate the file names of files that it encrypts (in-emode). the names of each file are stored within the file.gpgdir_map_filefor every sub-directory, and this file is itself encrypted. in decryption mode (-d), the-Oargument reverses the process so that the original files are restored. mystery era π΅οΈβοΈ--overwrite-encryptedβ overwrite encrypted files even if a previous<file>.gpgfile already exists.--overwrite-decryptedβ overwrite decrypted files even if the previous unencrypted file already exists.-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 thedefault-keyvariable in~/.gnupg/options. if thedefault-keyvariable 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).-a,--agentβ instructgpgdirto acquire gpg key password from a runninggpg-agentinstance. letting the agent handle it, we love a delegation moment π-A,--Agent-info <connection info>β specify the value of theGPG_AGENT_INFOenvironment variable as returned by thegpg-agent --daemoncommand. if thegpgdir --agentcommand line argument is used instead of--Agent-info, thengpgdirassumes that theGPG_AGENT_INFOenvironment variable has already been set in the current shell.-s,--skip-testβ skip encryption and decryption test. this will allowgpgdirto 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. silent but deadly π«Ά--no-recurseβ instructgpgdirto not recurse through any subdirectories of the directory that is being encrypted or decrypted.--no-passwordβ instructgpgdirto not ask the user for a password. this is only useful when a gpg key literally has no associated password (this is not common). rare behavior fr fr π--no-deleteβ instructgpgdirto not delete original files at encrypt time.--no-preservetimesβ instructgpgdirto not preserve original filemtimeandatimevalues upon encryption or decryption.-l,--locale <locale>β provide a locale setting other than the default"C"locale.--no-localeβ do not set the locale at all so that the default system locale will apply.-v,--verboseβ run in verbose mode. she's telling you EVERYTHING and honestly? we're listening π’-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.
π ENVIRONMENT π
HOMEβ set the default home directory.GNUPGBINβ set the gpg binary. default:"gpg".GNUPGHOMEβ set the default working directory for gpg. default:"~/.gnupg".
β 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 /some/dir
to encrypt a directory, and use the wipe command to securely delete the original unencrypted files:
$ gpgdir -W -e /some/dir
to encrypt a directory with the default GnuPG key defined in ~/.gnupg/options:
$ gpgdir -e /some/dir --Default-key
to decrypt a directory with a key specified in ~/.gpgdirrc:
$ gpgdir -d /some/dir
to encrypt a directory but skip all filenames that contain the string "host":
$ gpgdir -e /some/dir --Exclude host
to encrypt a directory but only encrypt those files that contain the string "passwd":
$ gpgdir -e /some/dir --Include passwd
to acquire the GnuPG key password from a running gpg-agent daemon in order to decrypt a directory (this requires that gpg-agent has the password):
$ gpgdir -A /tmp/gpg-H4DBhc/S.gpg-agent:7046:1 -d /some/dir
to encrypt a directory but skip the encryption/decryption test (so you will not be prompted for a decryption password):
$ gpgdir -e /some/dir -s
to encrypt a directory and no subdirectories:
$ gpgdir -e /some/dir --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. keeping it tidy, we love to see it β¨
π SEE ALSO π
π AUTHOR π
Michael Rash <mbr@cipherdyne.org>
π«Ά CONTRIBUTORS π«Ά
many people who are active in the open source community have contributed to gpgdir; see the CREDITS file in the gpgdir sources.
π BUGS π
send bug reports to mbr@cipherdyne.org. suggestions and/or comments are always welcome as well. not me asking you to email, but like, do it π
πΈ DISTRIBUTION πΈ
gpgdir is distributed under the GNU General Public License (GPL), and the latest version may be downloaded from http://www.cipherdyne.org
and that's the whole page bestie!! this one came out on Linux, dated May, 2007, source and version GPGDIR(1) β she's an elder icon and she still slays π
β¨ go encrypt something responsibly, mwah π
π¦ where this page comes from
- arch rolling: signing-party 2.11-2 Β· GPL
- debian bookworm: signing-party 2.11-1 Β· BSD-3-Clause
- debian trixie: signing-party 2.12-1 Β· BSD-3-Clause
- fedora 43: pgp-tools 2.10-16.fc43 Β· LicenseRef-Callaway-BSD AND GPL-2.0-or-later
- fedora 44: pgp-tools 2.10-17.fc44 Β· LicenseRef-Callaway-BSD AND GPL-2.0-or-later
- nixos 26.05: signing-party 2.12
- nixpkgs unstable: signing-party 2.12
- ubuntu jammy: signing-party 2.11-1 Β· BSD-3-Clause
- ubuntu noble: signing-party 2.11-1build1 Β· BSD-3-Clause
- ubuntu questing: signing-party 2.12-1
- ubuntu resolute: signing-party 2.12-1build1 Β· BSD-3-Clause
- ubuntu stonking: signing-party 2.12-1build1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms