encrypt file in batch mode

Tony Lane codeguro at gmail.com
Sat Nov 2 16:51:36 CET 2019


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On 11/2/19 10:35 AM, Fourhundred Thecat wrote:
> Hello,
> 
> how can I simply encrypt a file in "batch mode", ie in a script, without
> user interaction, without need for the user to type password, without
> gpg agent?

Assuming you're using gpg 2.2.7 or above...
gpg --batch --yes --passphrase="pw" --pinentry-mode loopback -o zz -esr user at domain.com zz.gpg
This can only be used if only one passphrase is supplied. Obviously, this
is of very questionable security on a multi-user system. Don't use this
option if you can avoid it. Also, unless you add yourself to the list of
recipients, you won't be able to decrypt the file even if you possess
the original unless you hold the private key for user at domain.com
-----BEGIN PGP SIGNATURE-----

iLgEARMKAB0WIQQWZv6JZKxO310TWtXo8fj9gx4T0wUCXb2mCAAKCRDo8fj9gx4T
0/bBAgkBu6q04gPAfuVKNM8aEA3PG67cDV1tBWhv7hLjI0envbtUFdk/s9MCL9/q
Nm7541e7VccYbvhwlY6MneswZPRoA2wCAwewuGZpXfSfc1QZOVr0y6PFLT2jmyvs
bZRLF60efew2LW74tlqZBlOKTcMYsq8vOv8rD8VdDAH2DyaZvZIUFM0q
=gQUz
-----END PGP SIGNATURE-----



More information about the Gnupg-users mailing list