其他
Linux 命令行生成随机密码的十种方法
原作者:LOWELL HEDDINGS
译 者:DatabaseHobbyist
原文链接:https://www.howtogeek.com/howto/30184/10-ways-to-generate-a-random-password-from-the-command-line/
#!/bin/bash
databases=("cadapte" "map_file" "workjieke")
for str in ${databases[@]};do
echo "create database " $str "/*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */ /*!80016 DEFAULT ENCRYPTION='N' */;"
password=`tr -cd '[:alnum:]' </dev/urandom | head -c 10`
echo "create user " $str"@'%' identified with mysql_native_password by" \"$password#\"";"
echo "grant all privileges on " $str ".* to " $str";"
done
date +%s | sha256sum | base64 | head -c 12 ; echo
< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-12};echo;
openssl rand -base64 12
tr -cd '[:alnum:]' < /dev/urandom | fold -w12 | head -n1
strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 12 | tr -d '\n'; echo
< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12
dd if=/dev/urandom bs=1 count=12 2>/dev/null | base64 -w 0 | rev | cut -b 2- | rev
</dev/urandom tr -dc '12345!@#$%qwertQWERTasdfgASDFGzxcvbZXCVB' | head -c8; echo ""
randpw(){ < /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-16};echo;}
date | md5sum