如何生成加密的密码 grub-md5-crypt
[root@ ~]# grub-md5-crypt Password: Retype password: $1$zUV8p1$pWr5yZnJ1ndOBuTfL8Q6b/ or echo "xansun" | openssl passwd -1 -salt $(< /dev/urandom tr -dc ‘[:alnum:]‘ | head -c 32) -stdin $1$wEBIWQRP$Jl02Mn9/vfZf.BlgvRyqM/
2. 添加一个账户 比如sa
useradd -u 500 sa echo "sa ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/sa # modify sa passwd sed -i ‘/^sa:/ s/\!\!/$md5/‘ /etc/shadow #$md5 是你grub-md5-crypt for example: sed -i ‘/^sa:/ s/\!\!/\$1\$AHS8p1\$IIRlEyuqYUYr8lwwuJJKo\//‘ /etc/shadow #modify end like this sa:$1$AHS8p1$IIRlEyuqYUYr8lwwuJJKo/:16267:7:90:14:::
在密码段中 $1 代表md5加密 AHS8p1 是salt IIRlEyuqYUYr8lwwuJJKo/ 是加密后的密码 [root@JXQ-23-54-2 ~]# openssl passwd -1 -salt AHS8p1 $passwd $1$AHS8p1$IIRlEyuqYUYr8lwwuJJKo/
密码修改的方式
echo "root:11111"|chpasswd or echo "11111"|passwd root --stdin
原文地址:http://my.oschina.net/davisqi/blog/293561