生成加密密码

#!/usr/bin/python
import crypt,random,string;
print(crypt.crypt("123456", '$6$' + ''.join([random.choice(string.ascii_letters + string.digits) for _ in range(16)])));
print(crypt.crypt("123456", '$6$' + ''.join([random.choice(string.ascii_letters + string.digits) for _ in range(16)])));

其中$6$表示密码加密方式为sha512

通过kickstart自动化安装系统

设置root密码
rootpw --iscrypted $6$uiq8l/7xEWsYXhrvaEgan4N21yhLa8K.U7UA12Th3PD11GOXvEcI40gp1

设置普通用户密码

Syntax
user --name=username [options]Below are some of the options which can be used with above syntax--name= - Provides the name of the user. This option is required.
--gecos= - Provides the GECOS information for the user. This is a string of various system-specific fields separated by a comma. It is frequently used to specify the user's full name, office number, and so on. See the passwd(5) man page for more details.--groups= - In addition to the default group, a comma separated list of group names the user should belong to. The groups must exist before the user account is created. See the group command.--homedir= - The home directory for the user. If not provided, this defaults to /home/username.--lock - If this option is present, this account is locked by default. This means that the user will not be able to log in from the console. This option will also disable the Create User screens in both the graphical and text-based manual installation.--password= - The new user's password. If not provided, the account will be locked by default.--iscrypted - If this option is present, the password argument is assumed to already be encrypted. This option is mutually exclusive with --plaintext.--shell= - The user's login shell. If not provided, the system default is used.--uid= - The user's UID (User ID). If not provided, this defaults to the next available non-system UID.--gid= - The GID (Group ID) to be used for the user's group. If not provided, this defaults to the next available non-system group ID.

user --name=dee --groups=whe --iscrypted --password=$6$NQxcaeY.Pvm1FWBl$LriLt5PFtqUUs0sJgUhpAwOc4n9dwJ0sx1qPDVXHZzXq0GnA8ZpuLkJG9QoGb5JwUv2/3JZLJBjDTUJXIP3bS

通过usermod修改用户密码

-p, --password PASSWORD       use encrypted password for the new password

usermod -p '$6$NQxcaeY.Pvm1FWBl$LriLt5PFtqUUs0sJgUhpAwOc4n9dwJ0sx1qPDVXHZzXq0GnA8ZpuLkJG9QoGb5JwUv2/3JZLJBjDTUJXIP3bS'  username

参考

https://www.golinuxhub.com/2018/01/how-to-create-user-normal-and-root/

https://www.golinuxhub.com/2017/07/sample-kickstart-configuration-file-for/

https://askubuntu.com/questions/80444/how-to-set-user-passwords-using-passwd-without-a-prompt

linux 用户密码加密相关推荐

  1. 用户密码加密存储十问十答,一文说透密码安全存储

    点击上方"方志朋",选择"设为星标" 回复"666"获取新整理的面试文章 作者 | 程序员赵鑫 来源 | cnblogs.com/xinzh ...

  2. linux用户密码策略求图,Linux用户密码策略

    Linux用户密码的有效期,是否可以修改密码可以通过login.defs文件控制.对login.defs文件修只影响后续建立的用户,如果要改变以前建立的用户的有效期等可以使用chage命令. Linu ...

  3. C#中使用MD5对用户密码加密与解密

    C#中常涉及到对用户密码的加密于解密的算法,其中使用MD5加密是最常见的的实现方式.本文总结了通用的算法并结合了自己的一点小经验,分享给大家. 一.使用16位.32位.64位MD5方法对用户名加密 1 ...

  4. [转]常见的用户密码加密方式以及破解方法

    [作者]张辉,就职于携程技术中心信息安全部,负责安全产品的设计与研发. 作为互联网公司的信息安全从业人员经常要处理撞库扫号事件,产生撞库扫号的根本原因是一些企业发生了信息泄露事件,且这些泄露数据未加密 ...

  5. 使用MD5对用户密码加密与解密

    MD5简介 : MD5的全称是Message-Digest Algorithm 5,在90年代初由MIT的计算机科学实验室和RSA Data Security Inc发明,经MD2.MD3和MD4发展 ...

  6. 新增用户-用户密码加密-无解密

    新增用户-用户密码加密 加密方式 需求 做法 加密方式 加密方式有多种,如1加密后可解密得到原文得.2加密后无解密方式,只能通过加密密文比对得.本文采取得就是第2种无解密方式加密 需求 springb ...

  7. Edusoho修改注册的用户密码加密机制规则

    一.简介 1.修改生成$salt的机制规则. 2.修改生成$password的机制规则. 二.edusoho的默认用户密码加密机制规则 1.系统默认生成$salt的方式: edusoho\src\Bi ...

  8. 修改linux用户密码(passwd)

    对于初学者来说,如何修改linux用户密码也不是件容易的事,其实非常简单,下面举例说明: (1)修改root用户密码 如果是以root身份登录,修改root密码. 只要输入 passwd 就会出现: ...

  9. 常见的用户密码加密及破解方法

    一.用户密码加密 用户密码保存到数据库时,常见的加密方式有哪些,我们该采用什么方式来保护用户的密码呢?以下几种方式是常见的密码保存方式: ① 直接明文保存,比如用户设置的密码是"123456 ...

最新文章

  1. scanf 接收 空格 输入_你需要知道的scanf函数用法
  2. php 工厂模式封装数据库,PHP设计模式之工厂模式
  3. 【Linux】一步一步学Linux——command命令(226)
  4. 每日站立会议 12.06
  5. 利用思科 Webex中的3个漏洞,以 ghost 用户身份参会
  6. imx8开发之~源码编译
  7. matlab判断李雅普诺夫稳定性
  8. 袖珍计算机英语手册,英语袖珍迷你系列-中考英语速记手册.pdf
  9. CTF 杂项 隐写术 密码学及编码 取证技术
  10. 聚合支付SAAS系统OEM贴牌定制开发聚合支付系统开发、聚合支付平台开发等。
  11. 华为搜索引擎Petal与Google的区别
  12. c语言中fabs是什么意思,c语言fabs是什么意思_后端开发
  13. 数学分析(7): 微分中值定理
  14. 留学Essay挂科后如何进行补救?
  15. 复旦女神陈果:孤独是一个人的狂欢,在你寂寞时请关注这些公众号充实自己
  16. java空指针异常 代码案例_java空指针异常:java.lang.NullPointException
  17. 【2013水王争霸赛】啊!
  18. 计算机网络中计算机通过率,自考计算机通过率高吗
  19. 计算机里面有鬼的恐怖游戏,胆小勿入!盘点史上十大最恐怖电脑游戏
  20. 双均线策略代码【利用聚宽平台】

热门文章

  1. 获取短网址的真实链接(java)
  2. 金蝶K/3 wise 服务器部署
  3. Cadence 环境配置
  4. QQweb登录通讯协议
  5. 通过实例学习C#(1)
  6. 混沌,分形与人工智能
  7. 抖音封禁4000个炫富账号,抖音开始严厉打击丨国仁网络
  8. 从Delta 2.0开始聊聊我们需要怎样的数据湖
  9. Handsontable - getSourceData 和 getData 区别
  10. 人工智能培训 python培训班免费