LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 01-09-2014, 11:21 AM   #1
postcd
Member
 
Registered: Oct 2013
Posts: 527

Rep: Reputation: Disabled
How to encrypt / password protect big linux file?


Hello,

i have around 20 backup files tar.gz with sensitive data. The sizes of these files are from around 200MB to around 20GB

I want to secure these files so no one can read, use its contents. only me

the method of encrypting, password protecting them should be fast, so for example in case of 20GB file, it wont take more than like 10 minutes of server work to "encrypt it"

it should be able to "encrypt/decrypt" them from linux command line.

Please do you have any ideas on how to do it?
 
Old 01-09-2014, 11:36 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
When you said encrypt/decrypt I immediately thought of GnuPG (gpg) which is often used for encrypting files. We use it for file transfers to and from other companies. I've not used it for a tar pipeline (I'm assuming you're doing something like that since you mentioned "backup" files. On searching for that I came across this link:
http://linux.icydog.net/ssh/piping.php

Which shows in part:
Quote:
2. Offsite backups

This is pretty much the same as above, except you want to transfer a bunch of files and leave them as a tarball on the server rather than as a bunch of files.

$ tar zcf - stuff | ssh user@server 'cat - > stuff.tar.gz'

You can also encrypt the tarball so that you'll have protection in case your backup server is hacked, gets stolen, or gains sentience. If you have a GPG keyring set up:

$ tar zcf - stuff | gpg -e | ssh user@server 'cat - > stuff.tar.gz.gpg'

If not, you can use a symmetric cipher just as easily (this should all be on one line):

$ tar zcf - stuff | openssl enc -rc4
| ssh user@server 'cat - > stuff.tar.gz.rc4'

Note that you can choose a cipher other than RC4. Just remember what the cipher was when decrypting (this should all be on one line):

$ ssh user@server 'cat stuff.tar.gz.rc4'
| openssl enc -rc4 -d -out stuff.tar.gz
Although it mentions offsite backups you could do it for on site. Haven't tried that myself though.

Last edited by MensaWater; 01-09-2014 at 12:49 PM.
 
Old 01-09-2014, 12:07 PM   #3
sgosnell
Senior Member
 
Registered: Jan 2008
Location: Baja Oklahoma
Distribution: Debian Stable and Unstable
Posts: 1,943

Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
gpg is the way to go, IMO. If it's not already installed, you can get it from the repositories of most distros. You can run it from the command line, with a script, or get a GUI frontend.
 
Old 01-09-2014, 12:51 PM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Quote:
Originally Posted by sgosnell View Post
a GUI frontend.
Such as...?
 
Old 01-09-2014, 01:09 PM   #5
metaschima
Senior Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
I'd say making an encrypted partition is a better option for multiple large files. You can use cryptsetup to make a LUKS partition, or truecrypt.

Also, I can't guarantee that "no one can read" the files. Certain agencies likely are able.
 
Old 01-09-2014, 02:07 PM   #6
Janus_Hyperion
Member
 
Registered: Mar 2011
Location: /
Distribution: Fedora (typically latest release or development release)
Posts: 372

Rep: Reputation: Disabled
Quote:
Originally Posted by MensaWater View Post
Such as...?
seahorse? I do not know if it's still available - the seahorse extension to nautilus.
 
Old 01-09-2014, 02:11 PM   #7
metaschima
Senior Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
There are some gpg GUIs listed here:
http://freecode.com/search?q=gpg&submit=Search
 
Old 01-09-2014, 02:51 PM   #8
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,337

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
I use the ccrypt command to encrypt sensitive data. You can read the data without making it readable to other people by using the ccat command which is an alias for:

ccrypt -c

see:

man ccrypt

-------------------------
Steve Stites
 
Old 01-09-2014, 03:55 PM   #9
metaschima
Senior Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
I've used ccrypt for a while, and I also recommend it for single files. Just remember that programs can leak information out. Let's say you use ccat to decrypt the file and pipe it to a program, and then the program makes temporary files in /tmp. I've seen it happen.

You will also want an encrypted swap partition in case these files are put in swap unencrypted.

Last edited by metaschima; 01-09-2014 at 03:56 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it possible to password protect a folder/file . I don't want to encrypt it karanace Linux - Software 2 03-02-2012 06:42 AM
Best way to encrypt (or at least password-protect) a single directory? agi93 Slackware 15 07-20-2010 11:37 PM
can i encrypt or password protect my initrd image??? raklo Linux - Kernel 14 02-13-2007 06:32 PM
password protect/encrypt a single image bruce1271 Linux - Software 2 10-18-2003 08:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 04:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration