Skip to content

Instantly share code, notes, and snippets.

@Korko
Created June 10, 2015 11:57
Show Gist options
  • Save Korko/26c0fa18c700f342b88a to your computer and use it in GitHub Desktop.
Save Korko/26c0fa18c700f342b88a to your computer and use it in GitHub Desktop.
Generate htpasswd with random password and send it by mail
#!/bin/bash
password=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 16 | xargs)
htpasswd -b /var/ddl.htpasswd korko "$password"
echo "Password set to: "$password | mail -s "Password ddl" "korko@localhost"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment