镜像制作过程网上一大堆,
问题表现在,可以通过cloudinit注入密码,但是注入后会提示首次登陆必须更改密码,谷歌了下似乎没人遇到这个问题,首先查看组策略,组策略中没有类似选项
如图
查看源代码
setuserpassword.py
def _change_logon_behaviour(self, username, password_injected=False):
"""Post set password logic
If the option is activated, force the user to change the
password at next logon.
"""
if CONF.first_logon_behaviour == NEVER_CHANGE:
return
clear_text = CONF.first_logon_behaviour == CLEAR_TEXT_INJECTED_ONLY
always = CONF.first_logon_behaviour == ALWAYS_CHANGE
if always or (clear_text and password_injected):
osutils = osutils_factory.get_os_utils()
osutils.change_password_next_logon(username)
得知解决办法
要么在 cloud.conf中添加 first_logon_behaviour = NEVER_CHANGE
要么直接修改这段代码 。
时间: 2024-10-29 00:13:46