summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-04-04 22:21:25 +0200
committerChristian Poessinger <christian@poessinger.com>2022-04-04 22:32:22 +0200
commit187ae2cdb841e578c36473c59724c7c1237c0fe6 (patch)
treeccfbc10b2b7dbf895891f48077ce224178bdaf2d
parentce1073f08d24d8c4bd2ffdd82fa87a89ee3a334d (diff)
downloadvyos-1x-187ae2cdb841e578c36473c59724c7c1237c0fe6.tar.gz
vyos-1x-187ae2cdb841e578c36473c59724c7c1237c0fe6.zip
login: T4341: disable user account prior to deletion
(cherry picked from commit efa753bc661d04967237e7ec3d72d3757230aaf9)
-rwxr-xr-xsrc/conf_mode/system-login.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/conf_mode/system-login.py b/src/conf_mode/system-login.py
index 8aa43dd32..ed4865f22 100755
--- a/src/conf_mode/system-login.py
+++ b/src/conf_mode/system-login.py
@@ -256,6 +256,9 @@ def apply(login):
if 'rm_users' in login:
for user in login['rm_users']:
try:
+ # Disable user to prevent re-login
+ call(f'usermod -s /sbin/nologin {user}')
+
# Logout user if he is still logged in
if user in list(set([tmp[0] for tmp in users()])):
print(f'{user} is logged in, forcing logout!')