Solved

encrypted zip with linux

Posted on 2006-11-25
7
1,611 Views
Last Modified: 2008-01-16
hi

I use this command to ackup and zip my database:

"mysqldump  -h $server -u $username -p$password -q $database | gzip > $path "

is there a way to encrypt the ziped file .. ?

thx
0
Comment
Question by:uk1900
7 Comments
 
LVL 58

Expert Comment

by:amit_g
ID: 18013655
Use crypt ...

crypt YourSecretKey < $path > TheEncryptedFile

To decrypt use

crypt YourSecretKey < TheEncryptedFile >  $path

Don't lose YourSecretKey.
0
 
LVL 48

Assisted Solution

by:Tintin
Tintin earned 100 total points
ID: 18015160
or you could actually use zip.

zip -e .......
0
 

Author Comment

by:uk1900
ID: 18015669
thx guys for your help,

u mean I can write :  zip -e $password   in the following command ?

"mysqldump  -h $server -u $username -p$password -q $database | zip -e $password > $path "
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 58

Accepted Solution

by:
amit_g earned 200 total points
ID: 18015793
If you want to do this in one line,

mysqldump  -h $server -u $username -p$password -q $database | gzip | crypt YourSecretKey > $path

If you want to use zip, you can do

mysqldump  -h $server -u $username -p$password -q $database | zip -e > $path

but in case of zip the password (key) is to be entered on the prompt. The command would propnt you to enter a password twice. You can't give that password in command line.
0
 
LVL 30

Assisted Solution

by:Kerem ERSOY
Kerem ERSOY earned 100 total points
ID: 18017719
Hi,

zip -e  will always ask for apssword from the standard input and if standard input is redirected to soemwhere else it will print an error message and exit. So it is not possible to run it noninteractively.

For crypt is not a standard application I will suggest you to use GnuPGP. It is a part of most inux Distros.

Visit here for usage info:
http://www.somacon.com/p107.php
http://www.cyberciti.biz/tips/linux-how-to-encrypt-and-decrypt-files-with-a-password.html

Cheers,
K.
0
 
LVL 16

Assisted Solution

by:xDamox
xDamox earned 100 total points
ID: 18019904
Hi,

Have you considered using the GnuGPG when you have your keys setup to encrypt files you simply do:

gpg -e file.zip

Have a read of the following guide I did;

http://www.linux-noob.com/forums/index.php?showtopic=1475
0
 

Author Comment

by:uk1900
ID: 18021672
thx guys for your help
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
If you use Debian 6 Squeeze and you are tired of looking at the childish graphical GDM login screen that is used by default, here's an easy way to change it. If you've already tried to change it you've probably discovered that none of the old met…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

821 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