GPG encryption and decryption of a folder using the command line

The gpg command line man page (Gnupg) has commands for encrypting and decrypting files. Here is the standard command to encrypt / decrypt files using gpg.

gpg --encrypt --recipient xxx@mail.com ~/xxx/xxx.txt - for encryption

gpg --output ~/xxx/xxx.txt --decrypt ~/xxx/xxx.gpg - for decryption

But if I have a folder with several files and folders, how can I encrypt it using the command line?

+8
source share
3 answers

Solution 1:

Use gpg-zip.

Encrypt the contents of the mydocs directory for user Bob to test1:

gpg-zip --encrypt --output test1 --gpg-args  -r Bob mydocs

List the contents of the test1 archive:

gpg-zip --list-archive test1

. , .

2:

, . :

tar czf myfiles.tar.gz mydirectory/

'myfiles.tar.gz', /. :

tar xzf myfiles.tar.gz

, . :

gpg --encrypt --recipient xxx@mail.com ~/xxx/xxx.txt

berkeley encrypting, .

: gnu gpg man

+17

cd

: $ls | gpg --multifile --encrypt $ls | gpg --multifile --encrypt $ls | gpg --encrypt-files $ls | gpg --encrypt-files

: $ls | gpg --multifile --decrypt $ls | gpg --multifile --decrypt $ls | gpg --decrypt-files $ls | gpg --decrypt-files

+1

gpgtar - . gpgtar . gpg-ized tar, , PGP PGP Zip.

gnupg MacOS Linux.

Encrypt directory

gpgtar --encrypt --output <out_file_name> -r <recipient> <dir_name>

Decrypt Directory

gpgtar --decrypt <out_file_name>

Gpgtar man page

0
source

All Articles