Tiny Core Base > Micro Core

password protecting a file via bash script ?

(1/1)

remus:
Hi all,

I'm trying to figure out how to password protect a file from a shell script, before uploading it to google drive for offsite backup.

I can't find reference about passing a password to bcrypt in the bcrypt command, it seems to want interaction...

Any comments and suggestions welcome.

Thanks.

Rich:
Hi remus
Try this:

--- Code: ---yes PASSWORD | bcrypt FILENAME
--- End code ---

remus:
Thx rich, works well.

Does bcrypt have a file integrity testing option like 7zip does ?

I just realised that it would be great to be able to run an integrity test on the file before uploading it.

Rich:
Hi remus

--- Quote ---Does bcrypt have a file integrity testing option like 7zip does ?
--- End quote ---
The programs usage doesn't mention it:

--- Code: ---tc@box:~$ bcrypt
Usage is: bcrypt -[orc][-sN] file1 file2..
  -o Write output to standard out
  -r Do NOT remove input files after processing
  -c Do NOT compress files before encryption
  -sN How many times to overwrite input files with random data
tc@box:~$
--- End code ---

remus:
I noticed that too Rich.

So I've done a little searching and discovered zip-unzip.tcz

And have come up with this.

zip -P password file.zip file.txt (Will create a password protected file with password as the password)

unzip -t -P password file.zip (Will test my archive, and I'm passing the password to it)

These commands will do for what I need. I know this approach has a few security flaw's. But It will do. I'm not dealing with national secrets.

Navigation

[0] Message Index

Go to full version