Code Monkey home page Code Monkey logo

sshluks's Introduction

sshluks

Small collection of shell scripts used for creating, enlarging, shrinking, mounting, and unmounting of crypto containers on sshfs remote storage.

Tools used: cryptsetup/LUKS for encryption, losetup for device mapping, sshfs for network access.

Important: mount_via_ssh.sh implements locking, such that no two clients will ever access the container file at the same time. Ignoring those locks can result in serious damage to the filesystem inside the container!

Getting started: Creating the container

  • Have a look at config.sh

  • Create directory for storing the container file on the remote host

    $ ssh server mkdir -p /srv/backup/flo/foobar/

  • Mount remote directory via sshfs

    $ sudo ./sshfs.sh server:/srv/backup/flo/foobar/ ~/mnt/server

  • Create container file with LUKS and filesystem inside

    $ sudo ./create.sh ~/mnt/server/container_file "ssh server" "/srv/backup/flo/foobar/container_file" 1024

  • Unmount sshfs

    $ sudo umount ~/mnt/server

Getting started: Using the container

  • Mount the filesystem inside the container for use

    $ sudo ./mount_via_sshfs.sh server:/srv/backup/flo/foobar/container_file ~/mnt/server ~/mnt/server_container

  • Perform your backup or whatever

  • Unmount the filesystem when you are done

    $ sudo ./umount.sh ~/mnt/server_container

More advanced stuff

  • Enlarge container file

    $ sudo ./enlarge.sh ~/mnt/server/container_file "ssh server" "/srv/backup/flo/foobar/container_file" 100

  • Shrinking container file

  • Does not work yet, but should be possible :-(

Bugs

Error handling is not good. If you make a mistake and some script fails at some point, there is not clean up. Everything just dies. Check losetup -a for active device mappings and /dev/mapper/ for cryptsetup mappings.

sshluks's People

Contributors

fw42 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

vedhavyas

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.