gpg encrypt always creates a new encrypted file

vedaal at nym.hush.com vedaal at nym.hush.com
Mon Oct 28 21:40:09 CET 2019


On 10/28/2019 at 3:43 PM, "Phillip Susi" <phill at thesusis.net> wrote:Anil Kumar Pippalapalli via Gnupg-users writes:

> Hello,
> I am trying to encrypt a file on my system using gpg —encrypt command but it always creates a new encrypted file I want to overwrite the original file instead so that I can only open it using passphrase. Is this possible.

gpg -encrypt foo && mv foo.gpg foo

=====

Alternatively, if you want no record of the plaintext  written to a file at all, you can type it into the command line, and have only the encrypted output written:

printf "whatever you write as plaintext" | gpg -a -e -r -o -filename.gpg | more

(obviously not intended for big files, or non-text files, but occasionally a useful workaround if you aren't comfortable with your system's 'wipe' process.)


vedaal




More information about the Gnupg-users mailing list