鏡像製作過程網上一大堆,
問題表現在,可以通過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
要麼直接修改這段代碼 。