{"id":1581,"date":"2014-06-23T16:22:23","date_gmt":"2014-06-23T14:22:23","guid":{"rendered":"http:\/\/www.daniel-ritter.de\/blog\/?p=1581"},"modified":"2024-05-13T22:49:02","modified_gmt":"2024-05-13T20:49:02","slug":"vault-create-and-mount-encfs-encrypted-directories-on-the-fly","status":"publish","type":"post","link":"https:\/\/www.daniel-ritter.de\/blog\/vault-create-and-mount-encfs-encrypted-directories-on-the-fly\/","title":{"rendered":"VAULT &#8211; A small script to create and mount encfs encrypted directories on the fly"},"content":{"rendered":"<p>This small script will allow you to create, mount and unmount encfs directories on the fly.<br \/>\nAs the need for encryption seems to rise all the time, usable solutions always come in handy.<\/p>\n<p>You can create a safe storage for sensible data quickly and easily with this script.<\/p>\n<p>All you need to do to is to install encfs with your distrubutions package manager and adjust the tiny CONFIG section to your needs.<br \/>\nThe script will take care of the rest (hopefully).<\/p>\n<p>Comments welcome.<\/p>\n<pre>\r\n#!\/bin\/bash\r\n#\r\n# VAULT\r\n# DR 20140624\r\n# https:\/\/www.daniel-ritter.de\/blog\/vault-create-and-mount-encfs-encrypted-directories-on-the-fly\r\n# \r\n# \r\n# CREATE AND MOUNT ENCFS ENCRYPTED DIRECTORIES ON THE FLY\r\n#\r\n# ENCFS NEEDS TO BE INSTALLED (apt-get install encfs for Debian\/Ubuntu)\r\n# ADJUST CONFIG SECTION TO YOUR NEEDS\r\n#\r\n# NO GUARANTEES, KNOW WHAT YOU ARE DOING\r\n# THIS IS LICENSED WITH GPL\r\n# http:\/\/www.gnu.org\/licenses\/gpl.txt\r\n\r\n\r\n\r\n# CONFIG\r\n\r\nVAULTBASEDIR=\/home\/myusername\r\nFILEMANAGER=nautilus\r\n\r\n# END OF CONFIG\r\n\r\n\r\nclear\r\necho \"VAULT\"\r\necho\r\n\r\n\r\n# INITIAL SETUP creates directories and sets up encryption\r\nif [ ! -d \"$VAULTBASEDIR\/.vault_dec\" ];then\r\necho \"NO VAULT FOUND. CREATING...\"\r\necho\r\necho\r\nencfs $VAULTBASEDIR\/.vault $VAULTBASEDIR\/.vault_dec\r\ntouch $VAULTBASEDIR\/.vault_dec\/mounted\r\nfusermount -u $VAULTBASEDIR\/.vault_dec\r\necho\r\necho\r\necho \"VAULT CREATED. RUN vault TO LOCK AND UNLOCK IT.\"\r\nexit\r\nfi\r\n\r\n\r\n\r\n# VAULT is unlocked, lock it\r\nif [[ -e $VAULTBASEDIR\/.vault_dec\/mounted ]];then\r\necho \"Locking VAULT\"\r\necho\r\nfusermount -u $VAULTBASEDIR\/.vault_dec\r\nls -la $VAULTBASEDIR\/.vault_dec\r\necho\r\necho\r\necho \"LOCKED\"\r\n\r\n\r\n# VAULT IS LOCKED, unlock it and open filemanager\r\nelse\r\necho \"UNLOCKING VAULT\"\r\nencfs $VAULTBASEDIR\/.vault $VAULTBASEDIR\/.vault_dec\r\n$FILEMANAGER $VAULTBASEDIR\/.vault_dec\r\nfi\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This small script will allow you to create, mount and unmount encfs directories on the fly. As the need for encryption seems to rise all the time, usable solutions always come in handy. You can create a safe storage for sensible data quickly and easily with this script. All you need to do to is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1965,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[227],"tags":[],"class_list":["post-1581","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.daniel-ritter.de\/blog\/wp-json\/wp\/v2\/posts\/1581","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.daniel-ritter.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.daniel-ritter.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.daniel-ritter.de\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.daniel-ritter.de\/blog\/wp-json\/wp\/v2\/comments?post=1581"}],"version-history":[{"count":8,"href":"https:\/\/www.daniel-ritter.de\/blog\/wp-json\/wp\/v2\/posts\/1581\/revisions"}],"predecessor-version":[{"id":1590,"href":"https:\/\/www.daniel-ritter.de\/blog\/wp-json\/wp\/v2\/posts\/1581\/revisions\/1590"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.daniel-ritter.de\/blog\/wp-json\/wp\/v2\/media\/1965"}],"wp:attachment":[{"href":"https:\/\/www.daniel-ritter.de\/blog\/wp-json\/wp\/v2\/media?parent=1581"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.daniel-ritter.de\/blog\/wp-json\/wp\/v2\/categories?post=1581"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.daniel-ritter.de\/blog\/wp-json\/wp\/v2\/tags?post=1581"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}