Encrypting contents of bzipped tarballs

Posted on 2006-04-04
Last Modified: 2010-04-22
I have a crude backup system for our office network consisting of a bash script that runs nightly at 3 AM, makes bzipped tarballs of some major directories and their sub-directories, and then creates a new folder to store these bzipped tarballs.

Once or twice a month on a Friday afternoon, I'll SSH into the server and create .iso files containing these bzipped tarballs and burn them to CD's.

Anyone with the smallest amount of computer knowledge could easily figure out how to unpack and view all this data if they got hold of any of these CD's.

How do I go about encrypting all this data prior to the tarballing and bzipping?
Can I work some encryption commands into my bash script that will do this for me?
What should I read up about in order to accomplish the creation of encrypted bzipped tarballs.

Thanks for you time and help.

Question by:Frybread
    1 Comment
    LVL 43

    Accepted Solution

    You could do such chain:
    tar the data, then encrypt it (with gpg), then bzip2 it.
    tar [options] | gpg -c | bzip2 > output.encrypted.tar.bz2

    or use zip or rar for that purpose (instead tar/bzip2)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    ​Being a Managed Services Provider (MSP) has presented you  with challenges in the past— and by meeting those challenges you’ve reaped the rewards of success.  In 2014, challenges and rewards remain; but as the Internet and business environment evol…
    BIND is the most widely used Name Server. A Name Server is the one that translates a site name to it's IP address. There is a new bug in BIND (, affecting all versions of BIND 9 from BIND 9.1.0 (inclusive) thro…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now