[PLUG] Command to encrypt files

Jon Drews jon.drews at gmail.com
Sun Aug 17 18:37:22 UTC 2014


Thanks Martin:

I too use the command line but not as often as I should.

I hope to make it to one of your meetings.
On Aug 17, 2014 11:33 AM, "Martin A. Brown" <martin at linux-ip.net> wrote:

>
> > My OS: Mint Linux 16
>
> > New member here. I would like to know if there is a command to
> > encrypt files? I thought it was "crypt" but I see that is in
> > section 3 of the man pages, meaning it's a programming function.
>
> I'm a command-line monster, so I would reach first for 'gpg'.  It's
> part of the 'gnupg' package.  I had a PDF hanging around in my home
> directory, and am using that as an example file below. These two
> commands do the same thing, just that one of them allows you to
> explicitly name the output file.  Regardless of the invocation, you
> will be prompted to type the encryption passphrase twice.
>
>    gpg --output W472242.PDF.gpg --symmetric -- W472242.PDF
>    gpg --symmetric -- W472242.PDF
>
> Then, to recover your data, you would decrypt as follows.
>
>    gpg --output W472242.PDF.aaa --decrypt -- W472242.PDF.gp
>    gpg --decrypt -- W472242.PDF.gpg  > W472242.PDF.bbb
>
> And, to verify that the encryption and decryption worked, you can
> see that I used the 'md5sum' utility to get a checksum of my data
> before and after.
>
>    $ md5sum  W472242.PDF*
>    c787744f66f790efeef893016c4ad587  W472242.PDF
>    c787744f66f790efeef893016c4ad587  W472242.PDF.aaa
>    c787744f66f790efeef893016c4ad587  W472242.PDF.bbb
>    f464112b24fe58c06f5a6f2eab6d7e2a  W472242.PDF.gpg
>
> Note that gpg can also handle public-key cryptography (which
> involves key-pairs) in addition to the simpler encryption shown
> above.  It is called symmetric, because you use the same passphrase
> for encryption as for decryption.
>
> -Martin
>
> --
> Martin A. Brown
> http://linux-ip.net/
> _______________________________________________
> PLUG mailing list
> PLUG at lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
>



More information about the PLUG mailing list