fix: disable password expiration for cloudroot

This commit is contained in:
Qiu Jian
2021-09-24 01:25:41 +08:00
parent 763fcd51e5
commit 91c595d4f7
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -259,7 +259,7 @@ func (f *SLocalGuestFS) userAdd(user, homeDir string, isSys bool) error {
}
cmd := []string{"chroot", f.mountPath, "useradd", "-m", "-s", "/bin/bash", user}
if isSys {
cmd = append(cmd, "-r")
cmd = append(cmd, "-r", "-e", "", "-f", "-1", "-K", "PASS_MAX_DAYS=-1")
}
if len(homeDir) > 0 {
cmd = append(cmd, "-d", path.Join(homeDir, user))
+1 -1
View File
@@ -428,7 +428,7 @@ func (p *SSHPartition) checkUser(user string) (exist bool, homeDir string, err e
func (p *SSHPartition) userAdd(user, homeDir string, isSys bool) error {
cmd := fmt.Sprintf("/usr/sbin/chroot %s /usr/sbin/useradd -m -s /bin/bash %s", p.mountPath, user)
if isSys {
cmd += " -r"
cmd += " -r -e '' -f '-1' -K 'PASS_MAX_DAYS=-1'"
}
if len(homeDir) > 0 {
cmd += fmt.Sprintf(" -d %s", path.Join(homeDir, user))