I have a file that is decrypted with a similar command:

gpg --batch --yes -q -d --passphrase-fd 0 -o "/var/file.out" "/var/file.gpg" < /var/secret.key 

I want to change the content of the /var/file.gpg but the decryption should continue work as before. Any idea how to encrypt it (I was able to find some examples with pass phrases (which I suppose is what the key file is used for) and sender and receiver (which I suppose I don't need) and it was not working so far)


Ok. I've found what I needed:

passphrase=$(head -n 1 /var/secret.key)
gpg --symmetric --batch --yes --passphrase $passphrase --output some.gpg  toEncrypt.txt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.