I'm running a Debian Sid box with the 2.6.18-4 kernel. I created a 1gb encrypted image file with the following commands (as root):
Code:
dd if=/dev/zero of=secure.img bs=1M count=1024
losetup /dev/loop/0 secure.img
cryptsetup -y create secure /dev/loop/0
mkfs.xfs /dev/mapper/secure
Once the file was created, I made two scripts, open and close, to access the encrypted file system.
open:
Code:
#!/bin/sh
/sbin/losetup /dev/loop/0 secure.img
/sbin/cryptsetup create secure /dev/loop/0
mount /dev/mapper/secure /home/crashsystems/Secure/files
close:
Code:
#!/bin/sh
umount /home/crashsystems/Secure/files
/sbin/cryptsetup remove secure
/sbin/losetup -d /dev/loop/0
Also, I've added the following entry into /etc/fstab:
Code:
/dev/mapper/secure /home/crashsystems/Secure/files xfs defaults,noatime,user 0 0
When I run these scripts as root, it mounts the file system just fine, and I can access it read/write as root, but I have read only access in my normal user account (crashsystems). I would like to be able to access the file system without giving my root password first, but most importantly I need to be able to have read/write access to it with a non-root account. When I try to run the open script as crashsystems, I get the following error:
Code:
crashsystems@csmobile:~/Secure$ ./open
/dev/loop/0: Permission denied
Command failed: Incompatible libdevmapper 1.02.12 (2006-10-13)(compat) and kernel driver
mount: only root can do that
I've checked out the permissions set on the binaries for mount, umount, losetup, and cryptsetup, and made sure that they were executable by everyone, but to no avail. If anyone knows what I might be doing wrong, that would be great.