mirror of
https://github.com/jupyterhub/the-littlest-jupyterhub.git
synced 2025-12-18 21:54:05 +08:00
Use gpasswd instead of usermod
usermod also calls checkfn, which freaks out when root password has expired. gpasswd does exactly what we want and nothing more.
This commit is contained in:
15
tljh/user.py
15
tljh/user.py
@@ -57,7 +57,7 @@ def ensure_group(groupname):
|
|||||||
|
|
||||||
def remove_group(groupname):
|
def remove_group(groupname):
|
||||||
"""
|
"""
|
||||||
Remove user from system if exists
|
Remove group from system if exists
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
grp.getgrnam(groupname)
|
grp.getgrnam(groupname)
|
||||||
@@ -83,11 +83,10 @@ def ensure_user_group(username, groupname):
|
|||||||
return
|
return
|
||||||
|
|
||||||
subprocess.check_call([
|
subprocess.check_call([
|
||||||
'usermod',
|
'gpasswd',
|
||||||
'--append',
|
'--add',
|
||||||
'--groups',
|
username,
|
||||||
groupname,
|
groupname
|
||||||
username
|
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@@ -100,8 +99,8 @@ def remove_user_group(username, groupname):
|
|||||||
return
|
return
|
||||||
|
|
||||||
subprocess.check_call([
|
subprocess.check_call([
|
||||||
'deluser',
|
'gpasswd',
|
||||||
'--quiet',
|
'--delete',
|
||||||
username,
|
username,
|
||||||
groupname
|
groupname
|
||||||
])
|
])
|
||||||
|
|||||||
Reference in New Issue
Block a user