From f42831f5362a36ce802674f2dedd40dbbbf35000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tuncay=20=C3=87OLAK?= Date: Fri, 28 Sep 2018 15:38:53 +0300 Subject: [PATCH] killall process of local user --- src/base/registration/registration.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/base/registration/registration.py b/src/base/registration/registration.py index cbe6271..7da69b4 100644 --- a/src/base/registration/registration.py +++ b/src/base/registration/registration.py @@ -188,10 +188,12 @@ class Registration: System.Process.kill_by_pid(int(System.Ahenk.get_pid_number())) def disable_local_users(self): + import time passwd_cmd = 'passwd -l {}' change_home = 'usermod -m -d {0} {1}' change_username = 'usermod -l {0} {1}' content = self.util.read_file('/etc/passwd') + kill_all_process = 'killall -KILL -u {}' for p in pwd.getpwall(): if not sysx.shell_is_interactive(p.pw_shell): @@ -202,8 +204,9 @@ class Registration: new_home_dir = p.pw_dir.rstrip('/') + '-local/' new_username = p.pw_name+'-local' - sysx.killuserprocs(p.pw_uid) + self.util.execute(kill_all_process.format(p.pw_name)) self.util.execute(passwd_cmd.format(p.pw_name)) self.util.execute(change_username.format(new_username, p.pw_name)) self.util.execute(change_home.format(new_home_dir, new_username)) self.logger.debug("User: '{0}' will be disabled and changed username and home directory of username".format(p.pw_name)) +