Files
org_roam/20250516161728-gpg_encryption.org
2026-03-08 13:04:05 +00:00

36 lines
844 B
Org Mode
Executable File

:PROPERTIES:
:ID: 30c28e5e-0b1c-43ae-b3bd-eb31023f8b73
:END:
#+title: gpg-encryption
#+filetags: :linux:security:gpg:
If you want to encrypt a file, use the following command:
#+begin_src bash
gpg -c file.txt
# options include :
# gpg -c file.txt : for symmetric encryption
# gpg -d file.txt.gpg : to decrypt the file
# gpg --batch -c --passphrase mypassphrase file.txt : accepts passphrase right from command line
#+end_src
and to decrypt, use:
#+begin_src bash
gpg -d file.txt
# You have to wait 10 minutes before you can get prompted for a password, before this, it will
# decrypt without the passphrase.
#+end_src
gpg --batch -c --passphrase Shakkal123! passwords.md
gpg --batch -d --passphrase Shakkal123! passwords.md.gpg
gpg --batch --output passwords.md -d --passphrase Shakkal123! passwords.md.gpg