Ask your questions here.
Post a reply

encfs folder with script

Sat Oct 19, 2013 3:55 am

Code:
#!/usr/bin/env bash

cryptdir=$(pwd)/$1
cleardir=$(pwd)/$2

#Edit: added the missing dollar signs as mentioned in the next post
encfs $cryptdir $cleardir

exit 0

Yes, that is not the new linux-kernel ... but rather easy.
Thing is that encfs needs the full path, which can be a pain. Tody i thought to try
try a script, and that seems to work.

What are possible problems? I can see that checking if said files exist is good. Bu
But else i think that is really all that is needed. Thanks for further problems, in
in case there are any (Or perhaps there is an easy cli way and i can simply skip
p the script. Right now i use "encfs $(pwd)/Name_of_Encrypted $(pwd)/Name_of_Clea
ean". Depending on the keyboard or my condition that ain't as much fun as it looks
oks like). I use encfs a lot, so this is really not a "everything-in-the-world-nee
needs-to-be-a-script, but quite an enhancement). If that is possible as an bash-a
alias i am more than fine with it. Thanks. (i am on cli, sorry for formatting).
Last edited by nadir on Sat Oct 19, 2013 5:53 pm, edited 1 time in total.

Re: encfs folder with script

Sat Oct 19, 2013 11:43 am

You need to add the dollar signs to the variables in the command in your script. Other than that, it seems to work, but I'm having a problem with creating the encrypted filesystem. How do you control the size of it? I used the script to create testdir and mount it at testmnt, and when I run df, it shows that the encrypted filesystem is the size of the partition that it's on. I tried it twice - once using expert mode and once using standard.

If the files/dirs don't exist when you run the script, encfs will ask to create them.

Also, it's not obvious in 'man encfs' how to unmount the encrypted filesystem. I used 'fusermount -u testmnt'. Is that the normal way to do it?

Re: encfs folder with script

Sat Oct 19, 2013 5:51 pm

Ups. Yeah, i had the Dollar in the script, but as i couldn't copy and paste i wrote it down wrong
(i will change it now above).

I don't know encfs well. I use it often, but always the same way (I always use standard).
I think that you will get all the space availabe to store suff in it.
(Mhhh.... well: just like if you create a usual folder, no?).
I used it as it was easy or looked easy to me, for folders, for files i use "gpg -c file", not because i considered it to be "better" (Well: if i don't understand the other solutions, then for me it is better :-) ).
On sticks and such i use cryptsetup (If i know what size i want). No clue if that would work with a folder too (you probably know it better than i do ).


I use "fusermount -u DectyptedFolder" too to umount.

After making the post yesterday i thought a bit about it. I thought: "Well, it really should be that easy". But i don't want to trash my encfs folders (as they contain my private-backups like ssh-keys).

---
I could check online or the scripts i got, but it's easier to ask:
Code:
if ! [[ -f $filename ]]
then
    echo "file doesn't exist. Will exit"
    exit -1
fi

Yes? (looks good to me ...).
Post a reply