Some of you already know that Windows zip combines several different functionalities:
- compression (like gzip),
- archiving multiple files into one (like tar),
- encryption (like gpg),
- plus some other.
Unix and Unix-like operating systems tend to split them so do not be surprised to have gzip for compression, tar for archiving files into one and gpg to encrypt.
In this article we will write about gpg
Having wrote that introduction, you probably are in situation where you need to put a password on a compressed archive and you realize tar or gzip cannot do that.
To the rescue comes gpg. There are other tools and ways to do so but I found gpg the simplest.
So, in order to encrypt an existing file, a compressed archived in our case, you need to do as follows:
$ gpg -o notes.tar.gz.gpg --symmetric archive.tar.gz
$ gpg notes.tar.gz.gpg
Output of such operation (do note that encrypt will prompt you for a password - not see in the output example):
flo@cygwin Stuff$ gpg -o notes.tar.gz.gpg --symmetric notes.tar.gz flo@cygwin Stuff$ ls -la notes.tar.gz* -rw-rw-r--+ 1 flo Domain Users 304M Aug 21 11:22 notes.tar.gz -rw-rw-r--+ 1 flo Domain Users 304M Aug 21 11:27 notes.tar.gz.gpg flo@cygwin Stuff$ rm notes.tar.gz rm: remove regular file 'notes.tar.gz'? y flo@cygwin Stuff$ gpg notes.tar.gz.gpg gpg: AES encrypted data gpg: encrypted with 1 passphrase flo@cygwin Stuff$ ls -la notes.tar.gz* -rw-rw-r--+ 1 flo Domain Users 304M Aug 21 11:28 notes.tar.gz -rw-rw-r--+ 1 flo Domain Users 304M Aug 21 11:27 notes.tar.gz.gpg