Hide your files really good in Linux

Hide your files really good in Linux

I have tons of confidential files on my Hard drive and I share my computer with a few people. So how do I keep my files private? tar, Gzip GPG and XZ that’s how I hide them!

$ tar -c dir/ | gzip | gpg -c | xz -9 |dd of=dir.tar.gz.gpg.xz

this command creates a tar file from dir folder and pipes it to gzip for compression then piped to gpg for encryption then piped again to xz for additional compression and outputted as dir.tar.gz.gpg.xz

extract and decrypt your file with

$ xz -d dir.tar.gz.gpg.xz && gpg -d dir.tar.gz.gpg | tar xfz –

You can substitute gpg for mcrypt

$ tar -c dir/ | xz -9 |mcrypt -a arcfour –mode stream -F |dd of=dir.tar.xz.nc

Similar to before this command creates a *tar* file of the dir folder, compresses it with xz, but encrypts it with mcrypt arcfour algorithm

extract with

$ mcrypt -d dir.tar.xz.nc && xz -d dir.tar.xz && tar xf dir.tar

Just remember a few things. One make sure you use a strong enough key so its harder to crack. Two if some one hijacks your computer they can read what’s in the RAM, and three I ca not stress the importance of having a complex secret key. Nothing less that 18 characters and use lowercase and uppercase mix in numbers and symbols such as @,#,^,%, and *.
Another thing I do is I chmod my files with 600 so users have no kind of permission over the file.
Keep your data safe.