I've solved the problem now after a bit more diagnosing.

Encfs doesn't like the temporary files that programs like rsync and 
unison create. For each file rsync transfers, it first saves a temporary 
version under a slightly different name, then when transfer is complete 
it moves the file to it's intended name. As encfs --reverse can't 
decrypt these files it raises an error.

The solution is to tell programs like this to use another directory for 
temporary/partial files. To get rsync working I made a directory 
'/tmp/rsync' and then tried rsync again with the -T option:
   rsync -av -T /tmp/rsync homedir_crypt/ homedir_crypt2/

This works perfectly on my local set up now with rsync. Make sure the 
temporary location is on a file system big enough to hold your biggest 
file -- you may run out of memory if /tmp/ is mounted as a tmpfs or ramfs.

I have yet to figure out if I can make unison use a different temporary 
location.

Damian


On 11/05/12 23:29, Damian Moore wrote:
> Hi all,
>
> I'd appreciate any insight into whether others think I'm doing something
> wrong or whether this could be a bug.
>
> What I'm trying to achieve is having two or more machines backing up a
> shared home directory to a untrusted location (eventually SSH over the
> internet). I would prefer that the home directories on the work
> laptop/desktop machines don't need encrypting with encfs so I am using
> the --reverse feature of encfs to create an encrypted 'view'. This
> encrypted directory will then be synced to a server so the other
> machines can then also pull down that directory to their reverse
> encrypted view and automatically decrypt to their actual unencrypted
> home directory.
>
> Files will be edited on any of the machines that share a home so the
> synchonisation must happen both ways.
>
> I have a test setup on my machine to made sure everything generally
> works. I have two directories representing home ones on different work
> machines, two dirs representing the reverse encrypted views mounted via
> fuse, and one more representing the remote dir on the server. So far I
> can add and edit a file in one unencrypted home dir, copy it's encrypted
> version to the second encrypted view via the remote dir. The second
> encrypted dir representing the other machine decrypts the new file and
> it appears perfectly saved in the other machine's home folder.
>
> The problem happens when i come to use rsync or unison to sync the
> reverse encrypted fuse directories.
>
>
> Here is the error I get when rsyncing from the remote server dir to the
> reverse encrypted dir:
>
>     damian@pc:~/sync$ rsync -av --delete remotedir/ homedir_crypt2/
>     sending incremental file list
>     lLw0AOIAWt9v5Jeb2H8xW,WZ
>     rsync: mkstemp
> "/home/damian/sync/homedir_crypt2/.lLw0AOIAWt9v5Jeb2H8xW,WZ.hwiLwE"
> failed: Input/output error (5)
>
>     sent 192 bytes  received 31 bytes  446.00 bytes/sec
>     total size is 1093  speedup is 4.90
>     rsync error: some files/attrs were not transferred (see previous
> errors) (code 23) at main.c(1070) [sender=3.0.9]
>
>
> Likewise, unison gives a similar error:
>
>     damian@pc:~/sync$ unison -batch remotedir/ homedir_crypt2/
>     ...
>     Error in querying file information:
>     Input/output error
> [lstat(/home/damian/sync/homedir_crypt/lLw0AOIAWt9v5Jeb2H8xW,WZ)]
>     ...
>     Failed: Error in querying file information:
>     Input/output error
> [lstat(/home/damian/sync/homedir_crypt2/.unison.lLw0AOIAWt9v5Jeb2H8xW,WZ.7342823a9de35b665d72e5e728d2c7d7.unison.tmp)
>
>
> My thinking is that maybe some of the filesystem calls these programs
> use are not being passed through encfs correctly to the real filesystem.
> Any thoughts?
>
> Thanks in advance.
> Damian
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Encfs-users mailing list
> Encfs-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/encfs-users


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Encfs-users mailing list
Encfs-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/encfs-users

Reply via email to