Encryption files with GPG without user intervention (batch)

I usually encrypt files with GPG with symmetric algorithms when I have to transmit files over insecure channel: for example I encrypt backup files stored at my USB stick and I’m sure that if it’s stolen or lost my files are in safety.

Encryption without user intervention can be used when you wish to perform automatic (runs with cron) backup procedure and protect backup files.

To encrypt file /tmp/file.tgz by symmetric AES algorithm (256 is a key lenght) with one command please use the following command:

echo password | gpg --batch -q --passphrase-fd 0 --cipher-algo AES256 -c /tmp/file.tgz

Previous command will create file.tgz.gpg that can be extracted automatically by next one:

echo password | gpg --batch -q -o /tmp/file.tgz --passphrase-fd 0 --decrypt /tmp/file.tgz.gpg

 
 
» You might also be interested in the following articles:
Create Linux user with password
WPA Wi-Fi encryption is now cracked
Secure shell (ssh) connection without password
Copy files from Windows or Mac to Linux safely
16 GB encrypted candy file



» Want to stay up to date? Subscribe to our E-MAIL or RSS feed!

4 Responses to “Encryption files with GPG without user intervention (batch)”


  1. 1 thehurley

    Thank you, just what I was looking for!

  2. 2 Phil waldron

    Thanks, simple and to the point

  3. 3 Kris Wolters

    Just bookmarked this blog!Glad i found it.

  4. 4 Marko

    Thanks man :) this is great help ~!

Leave a Reply




Friendly Sites:Who is behind Linux Screw?
GeekyBits³ | Bash Cures Cancer | OMG! Ubuntu!
My SysAd Blog | Web Upd8
ZEPY | Linux config Wiki | Planet Sysadmin
a non-geek's linux notes | Linux Today
Linux HOWTOs, Tutorials & Projects with Adam Palmer | LinuxAlt.Com
My name is Artem N. (artiomix AT gmail DOT com) and I'm Linux/Unix, Cisco systems engineer. The main idea of Linux Screw is to share relevant knowledge, skills and observations over The Web. Here you can find a lot of information related to different Linux distributions, FreeBSD, IOS as well as a other Open Source around staff. Read more ››