mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix: disable password expiration for cloudroot
This commit is contained in:
@@ -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))
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user