Skip to content

Instantly share code, notes, and snippets.

@aidmax
Last active January 23, 2019 21:48
Show Gist options
  • Save aidmax/749d79f5d118b72c776f243442556fc7 to your computer and use it in GitHub Desktop.
Save aidmax/749d79f5d118b72c776f243442556fc7 to your computer and use it in GitHub Desktop.

crontab add oneliner

(crontab -l; echo "0 */4 * * * ls")| crontab -

external IP to environment variable

export EXTERNAL_IP=$(dig @resolver1.opendns.com ANY myip.opendns.com +short)

Adding a secret to environment variable without echoing to console

read -sp "Secret: " VARIABLE_NAME
export VARIABLE_NAME
echo $VARIABLE_NAME

set random password for user

npsd=`openssl rand -base64 32`
yes $npsd | passwd root

sed substitutions

sed -i '/eula.accepted=1/c\eula.accepted=0' /opt/vconsole/config/console.properties
sed -i '/PasswordAuthentication yes/c\PasswordAuthentication no' /etc/ssh/sshd_config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment