Giter Site home page Giter Site logo

encfswrapper's Introduction

encfswrapper mounts an encfs filesystem while another program executes. When all instances of programs started by encfswrapper using the same encfs mount point have terminated, the encfs filesystem is unmounted automatically.

Requires

Installation

git clone https://github.com/lenzenmi/encfswrapper.git
cd encfswrapper
python setup.py install

Usage

Usage is pretty simple. just call encfswrapper like you would encfs but append the command you want to run with all of its arguments

encfswrapper encfsDir mountPoint (command [options...])

Useful Examples

Zim

Zim is a desktop wiki. It's lovely for making beautiful notes. It uses a simple markup language and stores everything in plain text files that can easily be read with any text editor.

Once you have a lot of useful notes, it may be nice to back them up on the cloud somewhere using a tool like rsync. The problem is that once you start sending your private notes out onto the internet, they become public. If you want your private notes to stay private, you'll need to encrypt them.

By default, zim stores your notes in your home folder in a directory called Notes. Lets move that.

mv ~/Notes ~/Notes-old

Next we need to make a few directories for encfs.

mkdir ~/.Notes # A hidden directory in your home folder for encrypted data.
mkdir ~/Notes # Zim's default storage folder

Now go ahead and setup encfs

encfs ~/.Notes ~/Notes

You'll be prompted for a password, and a bunch of other encfs settings. When it's done, Everything you copy into your ~/Notes folder will automatically be encrypted and stored in ~/.Notes. Let's do that.

rsync -av ~/Notes-old ~/Notes

You can view all of your data in ~/Notes in plain text. If you start zim, it should work fine.

You can also look inside ~/.Notes to see all of your data in encrypted form.

Let's unmount our encfs folder.

fusermount -u ~/Notes
ls ~/Notes
ls ~/.Notes

The ~/Notes folder should now be empty, but all of our encrypted data is still present inside ~/.Notes.

Now we can use encfswrapper to automate mounting this folder when we start zim.

encfswrapper ~/.Notes ~/Notes zim --standalone

Note

The standalone option is required to keep zim from daemonizing which would cause encfswrapper to unmount your encfs mount point.

Hooray! Zim should now be working normally and all of your stored notes will be encrypted! It's now safe to replicate your ~/.Notes folder anywhere on the internet.

A bit more advanced

Unfortunately the above command requires a lot more typing than before. Compare:

1 zim
2 encfswrapper ~/.Notes ~/Notes zim --standalone

We can improve this by writing a simple bash script and placing it in /usr/local/bin/zim and making it executable. If your PATH is setup correctly, as it should be by default, this file will run instead of the default /usr/bin/zim, thus overriding it.

/usr/local/bin/zim

#!/bin/bash
if [ "$ZIM_CRYPT" ] && [ "ZIM_MOUNT" ]; then
    encfswrapper  "$ZIM_CRYPT" "$ZIM_MOUNT" /usr/bin/zim --standalone
else
    /usr/bin/zim
fi

All we are doing here is checking to see if two environmental variables are set. If they are not, we run zim normally. If they are, we call encfswrapper to start zim.

Now all we have to do is set those environmental variables. Add these lines to your ~/.bashrc file.

export ZIM_CRYPT='~/.Notes'
export ZIM_MOUNT='~/Notes'

That's it. Now you can start your encrypted zim the same way you always have.

zim

encfswrapper's People

Contributors

lenzenmi avatar spohorec avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.