Skip to content

Instantly share code, notes, and snippets.

@in-in
Last active September 15, 2020 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save in-in/a69c34c3c1c038bf2083f6614d115f66 to your computer and use it in GitHub Desktop.
Save in-in/a69c34c3c1c038bf2083f6614d115f66 to your computer and use it in GitHub Desktop.
#! /bin/bash
# veracrypt_mount.sh
# how to run
# chmod u+x veracrypt_mount.sh && sudo ./veracrypt_mount.sh
USER_HOME=$(eval echo ~"${SUDO_USER}")
VOLUME_NAME='storage'
VOLUME_PATH='/dev/sda3'
CRYPTTAB='/etc/crypttab'
FSTAB='/etc/fstab'
mkdir -p "$USER_HOME/$VOLUME_NAME"
echo "$VOLUME_NAME $VOLUME_PATH none tcrypt-veracrypt" >> "$CRYPTTAB"
echo "/dev/mapper/$VOLUME_NAME $USER_HOME/$VOLUME_NAME ext4 nosuid,nodev,nofail 0 0" >> "$FSTAB"
tail -1 "$CRYPTTAB"
tail -1 "$FSTAB"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment