Skip to content

Instantly share code, notes, and snippets.

@DavidWittman
Last active April 18, 2016 20:41
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 DavidWittman/c003fc619e6abc4f65f65a4ece3a4fef to your computer and use it in GitHub Desktop.
Save DavidWittman/c003fc619e6abc4f65f65a4ece3a4fef to your computer and use it in GitHub Desktop.
s3cmd helper script to prompt for GPG passphrase for encrypting/decrypting
#!/usr/bin/env bash
# s3cmd helper script to prompt for GPG passphrase for encrypting/decrypting
S3CMD_CONFIG=${S3CMD_CONFIG:-"$HOME/.s3cfg"}
S3CMD="$(which s3cmd)"
if [[ -z "$GPG_PASSPHRASE" ]]; then
# Add the -s flag here to hide the passphrase
read -r -p "Encryption passphrase: " GPG_PASSPHRASE
fi
"$S3CMD" -c <(cat "$S3CMD_CONFIG"; echo gpg_passphrase="$GPG_PASSPHRASE") -e "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment