On Mac OS X, how to encrypt a small folder and copy that to Google Drive or DropBox

backupencryptionosx

On Mac OS X, right now I use the following to back up a small project folder to a USB Flash drive:

alias a='alias'
a dateseq='date "+%Y-%m-%d %H:%M:%S"'
a backup_proj='cp -a ~/code/MyProj "/Volumes/KINGSTON/MyProj `dateseq`"

so each time I type backup_proj, the folder is backed up from the hard drive to the USB drive, and each project is also internally version controlled using Git. Each folder is only about 500kb so it takes a long time to even fill up 1GB (the Flash Drive is 16GB). The folder is backed up as:

$ ls -1 /Volumes/KINGSTON/
MyProj 2012-05-27 08:20:50/
MyProj 2012-05-27 10:27:56/
MyProj 2012-05-27 14:53:01/

But I get paranoid and also want to back up to Google Drive or Dropbox so it will get uploaded to their server automatically, just by encrypting the whole folder and copying the single resulting file to Google Drive or DropBox's folder, and the password can be apple234321pineapple and specified on the command line. I wonder what is a good way to encrypt the folder into a single file so that it takes a non-practical time to crack? (can you please give the command line that will do it).

Best Answer

man zip

From the man page:

-e --encrypt Encrypt the contents of the zip archive using a password which is entered on the terminal in response to a prompt (this will not be echoed; if standard error is not a tty, zip will exit with an error). The password prompt is repeated to save the user from typing errors.

Another option is SSL encryption, example:

openssl des3 -salt -pass pass:password -in file.txt -out encfile.txt

Maybe you can TAR the folder before using openssl to encrypt it.

man openssl

Related Question