Use useradd rather than adduser to create users

Better suited for scripting use. adduser also seemed to
cause issues when root user's password had expired, so let's see
if useradd fixes that!
This commit is contained in:
yuvipanda
2018-07-03 17:20:41 -07:00
parent d7ddbf2a32
commit cb26150820

View File

@@ -22,10 +22,7 @@ def ensure_user(username):
pass pass
subprocess.check_call([ subprocess.check_call([
'adduser', 'useradd',
'--disabled-password',
'--force-badname',
'--quiet',
username username
]) ])
@@ -51,16 +48,9 @@ def ensure_group(groupname):
""" """
Ensure given group exists Ensure given group exists
""" """
try:
grp.getgrnam(groupname)
# Group exists, nothing to do!
return
except KeyError:
pass
subprocess.check_call([ subprocess.check_call([
'addgroup', 'groupadd',
'--quiet', '--force',
groupname groupname
]) ])