Wednesday, January 27, 2010

batch file to backup and encrypt to disk

There are times when backing up files to a USB drive is the only method that a client has chosen to perform their backups on their Windows machines. The best way to ensure that that USB is not stolen or lost, and then read, is to encrypt the files. Anyone who knows me knows that I love creating my own scripts and using open software to avoid high priced vendor solutions. Here is a quick process to give the backups some decent security.

Download and install Truecrypt (Excellent open source on-the-fly encryption tool).
Create encrypted volume inside USB (call it "backups" for this exercise)
Make sure you use strong password and remember it or keep it somewhere you can access it again
Download Robocopy (or Rsync)
Batch script:

"c:\program files\truecrypt\truecrypt.exe" /q /s /v e:\backups /lj /a /p password
robocopy C:\Users\Administrator\Documents j:\ *.doc
"c:\program files\truecrypt\truecrypt.exe" /q /dj

(here I create volume j, using weak password called "password" silent mode, don't show GUI, automount volume, then call robocopy to do the backup of .doc files in the Documents directory to the encrypted volume, then unmount volume)

There you have it, a USB thumbdrive with your encrypted files out of view.

No comments:

Post a Comment