Password-protect a directory (SOLVED)
Password-protect a directory (SOLVED)
Hi guys,
Just wondering if anyone can help me figure out how to password-protect a directory/folder in puppy? Bcrypt will do files no problem but not folders, and truecrypt won't work for my purposes.
Just wondering if anyone can help me figure out how to password-protect a directory/folder in puppy? Bcrypt will do files no problem but not folders, and truecrypt won't work for my purposes.
Last edited by hansol on Wed 08 Jan 2014, 01:17, edited 3 times in total.
tar your directory first to turn it into a file.
tar -cvzf /mnt/home/some_folder_name.tar.gz /mnt/home/some_folder_name
Here's how I added it to my right click menu
tar -cvzf /mnt/home/some_folder_name.tar.gz /mnt/home/some_folder_name
Here's how I added it to my right click menu
trapster
Maine, USA
Asus eeepc 1005HA PU1X-BK
Frugal install: Slacko
Currently using full install: DebianDog
Maine, USA
Asus eeepc 1005HA PU1X-BK
Frugal install: Slacko
Currently using full install: DebianDog
Ahh okay I see the logic here. That makes sense.
I guess the second part of the question then is I would like to automate the "encryption" process. Basically I would like to write a script that first compresses the folder, and second encrypts the folder using bcrypt. So far I have the first part, but not the second part.
First part of code is:
The second part of my code is
The first part I have running fine, and can generate a zipped folder with the correct contents in the correct directory, but the bcrypt/encryption code part doesn't seem to do anything. I'm a very big newb at this stuff, so I very much appreciate all you more experienced guys' help. Thanks -Hansol[/code]
I guess the second part of the question then is I would like to automate the "encryption" process. Basically I would like to write a script that first compresses the folder, and second encrypts the folder using bcrypt. So far I have the first part, but not the second part.
First part of code is:
Code: Select all
#!/bin/bash
tar -cvzf /wheretolocatefile/filename.tar.gz /where/tocopyfrom
Code: Select all
bcrypt /compressed/fileiwantencrypted -c"passwordiwant" -c"passwordiwant"
This is not the most secure way to do things as it exposes your password.
But it works.
But it works.
Code: Select all
#!/bin/sh
pw=12345678
yes $pw | bcrypt /compressed/fileiwantencrypted
trapster
Maine, USA
Asus eeepc 1005HA PU1X-BK
Frugal install: Slacko
Currently using full install: DebianDog
Maine, USA
Asus eeepc 1005HA PU1X-BK
Frugal install: Slacko
Currently using full install: DebianDog
Trapster,
Thank you so much! I never would have figured out that code sequence on my own, so I very much appreciate your help.
Basically the reason I'm not too worried about "exposing" the password is the files are all to be encrypted on a secure machine first, and then transferred to a totally separate machine. That machine has no way of ever talking to/accessing the original machine with the scripts on them, so the chances of the passwords ever being figured out are slim to none. Basically I just needed a functional and automated way to quickly compress a folder, encrypt it, and then transfer to the secondary machine.
Thanks again for your help -Hansol
Thank you so much! I never would have figured out that code sequence on my own, so I very much appreciate your help.
Basically the reason I'm not too worried about "exposing" the password is the files are all to be encrypted on a secure machine first, and then transferred to a totally separate machine. That machine has no way of ever talking to/accessing the original machine with the scripts on them, so the chances of the passwords ever being figured out are slim to none. Basically I just needed a functional and automated way to quickly compress a folder, encrypt it, and then transfer to the secondary machine.
Thanks again for your help -Hansol
Hello to all.
Interesting topic. There's something new to be learned every day, isn't there?
Couldn't something similar be achieved in just one go with zip? I mean with
zip -9 -r -e < name-of-folder.zip > < folder >
Where:
-9 : means: compress better
-r : compress everything in folder, recursive.
-e : the encryption (password) prompt
The compression rate with zip might be less, of course. And perhaps using bcrypt
separately gives a more powerful encryption? I'm still a novice in such things.
Thanks in advance for any lead.
musher0
Interesting topic. There's something new to be learned every day, isn't there?
Couldn't something similar be achieved in just one go with zip? I mean with
zip -9 -r -e < name-of-folder.zip > < folder >
Where:
-9 : means: compress better
-r : compress everything in folder, recursive.
-e : the encryption (password) prompt
The compression rate with zip might be less, of course. And perhaps using bcrypt
separately gives a more powerful encryption? I'm still a novice in such things.
Thanks in advance for any lead.
musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
Ok one last noob query for the "encrypting" code, and then I will stop harassing you gentlemen on the forum here:
I've got all the code written, but the problem is the scripts are separate: I have one script written for tar-ing the files, and a second script written for bcrypting the files. I would like to combine the two scripts, the first one being:
and the second being trapster's code
What I would like to understand specifically is how to get the following "process" coded correctly:
line 1: compress file A
line 2: compress File B
line 3: bcrypt File A
line 4: bcrypt File B
Right now my code looks like:
So like I said above, this script seems to run the compression part correctly, but the encryption stage doesn't seem to do anything.
I know that the above code is probably quite painful for you experienced guys to read. I freely admit I have a very weak grasp on coding language, but I'm really trying to google and research as much as I can before posting here. I'm convinced the code above will work, as the scripts all work perfectly when I run them individually; it's just when I add all the pieces together in one script that it stops working. I'm sure the issue is based on me not using correct terminal syntax, but I can't quite pinpoint where I'm going wrong...
Thanks for your patience -Hansol
I've got all the code written, but the problem is the scripts are separate: I have one script written for tar-ing the files, and a second script written for bcrypting the files. I would like to combine the two scripts, the first one being:
Code: Select all
#!/bin/bash
tar -cvzf /wheretolocatefile/filename.tar.gz /where/tocopyfrom
Code: Select all
#!/bin/sh
pw=12345678
yes $pw | bcrypt /compressed/fileiwantencrypted
line 1: compress file A
line 2: compress File B
line 3: bcrypt File A
line 4: bcrypt File B
Right now my code looks like:
Code: Select all
#!/bin/bash
tar -cvzf /location/fileA.tar.gz /location/of/fileA
tar -cvzf /location/fileB.tar.gz /location/of/fileB
#!/bin/sh
pw=pswd-for-A
yes $pw | bcrypt /location/fileA.tar.gz
#!/bin/sh
pw=pswd-for-B
yes $pw | bcrypt /location/fileB.tar.gz
I know that the above code is probably quite painful for you experienced guys to read. I freely admit I have a very weak grasp on coding language, but I'm really trying to google and research as much as I can before posting here. I'm convinced the code above will work, as the scripts all work perfectly when I run them individually; it's just when I add all the pieces together in one script that it stops working. I'm sure the issue is based on me not using correct terminal syntax, but I can't quite pinpoint where I'm going wrong...
Thanks for your patience -Hansol
If you have 1 password you shouldn't need "pswd-for-B"
If you have 2 passwords
Code: Select all
#!/bin/bash
pw=password
tar -cvzf /location/fileA.tar.gz /location/of/fileA
tar -cvzf /location/fileB.tar.gz /location/of/fileB
yes $pw | bcrypt /location/fileA.tar.gz /location/fileB.tar.gz
Code: Select all
#!/bin/bash
pwa=pswd-for-A
pwb=pswd-for-B
tar -cvzf /location/fileA.tar.gz /location/of/fileA
tar -cvzf /location/fileB.tar.gz /location/of/fileB
yes $pwa | bcrypt /location/fileA.tar.gz
yes $pwb | bcrypt /location/fileB.tar.gz
trapster
Maine, USA
Asus eeepc 1005HA PU1X-BK
Frugal install: Slacko
Currently using full install: DebianDog
Maine, USA
Asus eeepc 1005HA PU1X-BK
Frugal install: Slacko
Currently using full install: DebianDog
I'm a bit late to the discussion but I thought this could be of interest to OP and others. I use encfs to mount a encrypted folder on my my-documents folder
encfs is installed from the package manager.
I use this command to mount the partition.
To make sure I don't loose my-documents I use btsync to replicate .my-documents to a backup server.
And at last a friendly warning. I thought this was such a good Idea that I encrypted quite a few folders. I was not clever enough to keep a copy of my password. So at the moment I have a folder with a password I can't for the life of me remember
Currently I'm running this on precise-5.7.1
encfs is installed from the package manager.
I use this command to mount the partition.
Code: Select all
encfs ~/.my-documents ~/my-docuuments -o nonempty
And at last a friendly warning. I thought this was such a good Idea that I encrypted quite a few folders. I was not clever enough to keep a copy of my password. So at the moment I have a folder with a password I can't for the life of me remember
Currently I'm running this on precise-5.7.1