Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- NUM_ARGS=$#
- echo
- echo "###############################################"
- echo "# dm-crypt LUKS Container MAKER - 0.1 #"
- echo "###############################################"
- echo
- if [ $NUM_ARGS -ne 2 ] ; then
- echo Wrong number of arguments.
- echo Usage: [size in MB] [file to create]
- else
- SIZE=$1
- FILE=$2
- # create file
- echo "Creating $FILE with a size of ${SIZE}MB"
- fallocate -v -l ${SIZE}MB $FILE
- # randomize file contents
- echo
- echo "Randomizing content"
- dd if=/dev/urandom of=$FILE bs=1MB count=$SIZE
- # creating a dm-crypt LUKS Container in the file
- echo
- echo "Creating dm-crypt LUKS Container (AES-XTS-PLAIN64, 256, SHA512)"
- cryptsetup -v -q --cipher aes-xts-plain64 --key-size 512 --hash sha512 --iter-time 5000 --use-urandom --verify-passphrase luksFormat $2
- # modify owner
- echo
- echo "Modifying permissions"
- chown unknown:unknown $FILE
- chmod 660 $FILE
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement