LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   Encrypt /home and USB-memory (https://www.linuxquestions.org/questions/linux-security-4/encrypt-home-and-usb-memory-344222/)

hyllplan 07-18-2005 06:05 AM

Encrypt /home and USB-memory
 
Hi,

1) I would like to encrypt /home, what would be a simple approach to do this?, the algorithm does'nt really matter, but I want it more secure than e.g. DES.

2) Also I would like to encrypt my USB-memory, I am using FAT32 on that memory because I want to be able to read it from Windows as well. Is it possible to encrypt it so I will be able to unencrypt it in Linux and as well in Windows?

Thanks,
- Johan

mattLSO 07-18-2005 08:08 AM

With reference to the first question, you could use cryptoloop or CFS an NFS wrapper, there
is a good howto here http://www.tldp.org/HOWTO/Cryptoloop-HOWTO/.

Regards

hyllplan 07-18-2005 08:57 AM

Thanks, I will try it out
- Johan

hyllplan 07-20-2005 05:27 AM

Thanks mattLSO for the tip, it turned out that cryptoloop is depreciated in krn 2.6.11 and you should now go for dm-crypt instead. I have tried it on my memorystick and it worked fine with ext3 and everything.
As dm-crypt is a device-mapper thing I have to load the following before I can mount the encrypted filesystem:

'cryptsetup create sda1 /dev/sda1' (I have to give my password at this stage)
and then 'mount /dev/mapper/sda1 /mnt/usbkey'

and the following to umount:

'umount /mnt/usbkey'
'cryptsetup remove sda1'

Now I want to try this out for my /home, but I have to run the cryptsetup thing before mount and after umount. I can put "/dev/mapper/sda1 /mnt/usbkey" in /etc/fstab, but what about the cryptsetup thing (that prompts me for my password). Where could I put the line to make it happen at the right time (before mount of /home and after umount of /home)

Thanks!,
- Johan

mattLSO 07-23-2005 10:55 AM

Hey in fstab on the line of the /home add this
Quote:

noauto
Example:

Quote:

/dev/hda3 /home ext3 errors=remount-ro,noauto 0 1
This will prevent it from being mounted on boot then in (On Debian, redhat is /etc/rc.d/init.d) /etc/init.d/ create a script called docrypto to run the commands, chmod 755 it then

Quote:

cd /etc/rc3.d
ln -s ../init.d/docrypto S10crypto
This will load your crypto commands on boot, as for unmounting when init changes runlevel on shutdown or reboot it calls the script with stop, just make sure it has the following format.

Quote:

#! /bin/sh
case "$1" in
start)
echo -n "Starting cryptographic system"
#put your start commands here
echo "."
;;
stop)
#shutdown commands
;;
restart)
stop()
start()
;;
*)
echo "Usage: docrypto (start/stop/restart)"
exit 1
esac
exit 0

Hopefully this will put you on the right path

Regards


All times are GMT -5. The time now is 11:57 PM.