Luks mountscript

Aus Cryptronic
Wechseln zu: Navigation, Suche
#/bin/sh
#Mounting Encrypted USB Storage Script

#Mounting USB Device
echo "======================================="
echo "=  Mounting Script v 1.0 by O. Werner ="
echo "=                                     ="
echo "=          mail@cryptronic.de         ="
echo "=                                     ="
echo "= This script mounts your USB Storage ="
echo "= device, copy all data into am RAMFS ="
echo "= and unmount the stick.              ="
echo "=                                     ="
echo "=     No warranty for loosing data    ="
echo "======================================="
echo ""
echo "Make sure that the USB Storage Device is plugged in and you now the Devicename"
echo -n "Are you sure? (yes/no)"
read sure
if [[ $sure = "" ]]
 then
 echo "Please type the correct values"
 exit
fi

if [[ $sure = "no" ]]
 then
 echo "Aborting..."
 exit
fi

if [[ $sure = "yes" ]]
then
 echo ""
 echo "Let's start"
 echo ""
 echo -n "Please specify Device: "
 read dev
 echo -n "Please specify Path to mount ramfs to: /mnt/"
 read path
 echo "Now starting"
 echo ""
 echo "Now mounting the Device"
 echo ""
 cryptsetup luksOpen /dev/$dev encrypted
 echo ""
 echo "Now mounting the Device"
 echo "..."
 mkdir /mnt/temp
 echo "..."
 mount /dev/mapper/encrypted /mnt/temp
 echo "Mounted succesfully"
 echo ""
 echo "Now creating ramfs"
 echo "..."
 mkdir -p /mnt/$path
 echo "..."
 mount ramfs ramfs /mnt/$path
 echo "RAMFS successfully set up"
 echo ""
 echo "Now coping files"
 echo "..."
 cp -rf /mnt/temp/* /mnt/$path
 echo "Coping successfully done"
 echo ""
 echo "Now unmounting the USB Device"
 echo "..."
 umount -l /mnt/temp
 echo "..."
 cryptsetup luksClose encrypted
 echo "Successfully unmounted"
 echo ""
 echo "deleting unused Files"
 rm -rf /mnt/temp
 echo "files deleted"
 echo ""
 echo "Operation completed"
else
 echo "Please type the correct values"
 exit
fi
exit
Meine Werkzeuge
Namensräume
Varianten
Aktionen
Navigation
Tipps
Werkzeuge