• [技术干货] 华为云服务器shell生成随机密码和生成shadow格式用的密码
    华为云服务器shell生成随机密码 [code][root@hwclouds-ecs-100 ~]# cat /dev/urandom | awk 'NR==1{print $0|"md5sum|base64|grep -Eo '^.{16}'";exit}' YWFhMzA4MmQ4YjBk [root@hwclouds-ecs-100 ~]# /dev/urandom awk 'NR==1{print $0|"md5sum|base64|grep -Eo '^.{16}'";exit}' ODc1ZTQzYTNkYjQ1 [root@hwclouds-ecs-100 ~]# od -N8 -tx8 /dev/random | awk 'NR==1{print $NF}' 9404172875d9c080 [root@hwclouds-ecs-100 ~]# cat /dev/urandom | awk 'NR==1{print $0|"md5sum|head -c 16";exit}';echo dc836360f4ce5c02 [root@hwclouds-ecs-100 ~]# echo "$(date +%s)"|sha256sum|base64|head -c 16;echo YmQzNmRhNDYwNTYx [root@hwclouds-ecs-100 ~]# mkpasswd -l 16 -d 5 -C 5 E5s{2g7yQM7NHgf5 [root@hwclouds-ecs-100 ~]# /dev/urandom tr -dc A-Z-a-z-0-9 | head -c${1:-16};echo; XLGoh2gLkvZTn1o9 [root@hwclouds-ecs-100 ~]# openssl rand -hex 8 f43a35be7dc0122b [root@hwclouds-ecs-100 ~]# dd if=/dev/urandom bs=1 count=32 2>/dev/null |base64|head -c16;echo kuH3aB5lcPP4IPAp [root@hwclouds-ecs-100 ~]#[/code] 华为云服务器shell生成shadow格式用的密码 [code][root@hwclouds-ecs-100 ~]# perl -e 'print crypt("password","\$6\$salt\$") . "\n"' $6$salt$IxDD3jeSOb5eB1CX5LBsqZFVkJdido3OUILO5Ifz5iwMuTS4XMS130MTSuDDl3aCI6WouIL9AjRbLCelDCy.g. [root@hwclouds-ecs-100 ~]# python -c "import crypt, getpass, pwd;print crypt.crypt('password', '\$6\$saltsalt\)" $6$saltsalt$qFmFH.bQmmtXzyBY0s9v7Oicd2z4XSIecDzlB5KiA2/jctKu9YterLp8wwnSq.qc.eoxqOmSuNp2xS0ktL3nh/ [root@hwclouds-ecs-100 ~]# python -c "import crypt, getpass, pwd; print crypt.crypt(raw_input(), '\$6\ + raw_input() + '\)" lookback saltsalt $6$saltsalt$a0J/T8m/LXCZ3GWU2k8doYlZYN63LQj7MJnPST15U/v.RpsP5vnt0qtkByqSO/fVa0Qby6BDIi.J94pt3RmKz. [root@hwclouds-ecs-100 ~]# python -c "import crypt, getpass;print crypt.crypt('password')" #上面都是指定salt的,这个就是随机加盐的 $6$hppfi2m5kPwuxG.e$c8IWMJKk6qo8NSdV6sMghnSPolow7ngvQoKlMw6bH/BYogWmExsnxCMVSkVNJdn3jPhQPF/s7t5KkDFiJ3IjU0 [root@hwclouds-ecs-100 ~]#[/code]
总条数:136 到第
上滑加载中