From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from cordova.acsalaska.net (cordova.acsalaska.net [209.112.173.243]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.saout.de (Postfix) with ESMTPS for ; Thu, 13 Jan 2011 02:31:33 +0100 (CET) Date: Wed, 12 Jan 2011 15:57:02 -0900 From: Roger Message-ID: <20110113005702.GB4513@localhost2.local> References: <20110112053435.GB5368@localhost2.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [dm-crypt] Auto Mounting when file accessed? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ma Begaj Cc: dm-crypt@saout.de >On Wed, Jan 12, 2011 at 10:05:00PM +0100, Ma Begaj wrote: >inotify-tools could probably help you... something like this could >work, i think; > >------------------------------------ >#!/bin/sh > ># watch for folders >inotifywait -m -r --format "%e %w%f" /mnt/crypt | while read event file; do > > # and mount if not mounted > if ! df | grep /mnt/crypt >/dev/null ; then > mount /mnt/crypt > fi >done >------------------------------------ I tried this and, instead of using "mount /mnt/crypt", I designated a script to run instead of using "mount /mnt/crypt". I kept getting a superblock/e2fsck error. My script "mount-crypt" is nearly error proof as it utilizes losetup, cryptsetup, and then calls e2fsck each time before mounting to /mnt/crypt. mount-crypt always calls umount-crypt encase losetup is halfway started, and then always calls e2fsck before mounting to /mnt/crypt. The other issues are: 1) Using inotify requires to be in a script and needing to be started at startup. 2) It needs to embed password or app-crypt/pinentry 3) pinentry or asking for a passphrase is likely going to only occur on the terminal inotify script is started from, vs for the terminal wanting access to file or folder. Think #3 is going to be the real issue because it's calling mount-crypt from another terminal or it's own bash process. I know the pinentry gui prompt is likely not an issue though. ...anyways, I likely need to research everything here again and do some more testing. Technically, everything I'm doing in mount-crypt should likely be done behind the scenes. -- Roger http://rogerx.freeshell.org/