summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2010-03-15 10:46:12 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2010-03-15 10:46:12 -0700
commite4d6fe0018945aae9215c27a479108a1bd1c86ed (patch)
tree5d152f5de63b3721a3b98b2b536e2ca4d8af33da
parenta824dee9afa1efd1ec34561388bce8f8ad25333e (diff)
downloadvyatta-cfg-system-e4d6fe0018945aae9215c27a479108a1bd1c86ed.tar.gz
vyatta-cfg-system-e4d6fe0018945aae9215c27a479108a1bd1c86ed.zip
Force user to be logged out
Bug 5067 Need to force user off with SIGHUP/SIGKILL. Shells started from telnet ignore SIGTERM.
-rwxr-xr-xlib/Vyatta/Login/User.pm7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Vyatta/Login/User.pm b/lib/Vyatta/Login/User.pm
index e4909b9a..afc3cf53 100755
--- a/lib/Vyatta/Login/User.pm
+++ b/lib/Vyatta/Login/User.pm
@@ -109,8 +109,11 @@ sub _delete_user {
} elsif ( getlogin() eq $user ) {
die "Attempting to delete current user: $user\n";
} else {
- # This logs out user (so we can delete it)
- system("pkill -u $user");
+ if (`who | grep "^$user"` ne '') {
+ warn "$user is logged in, forcing logout\n";
+ system("pkill -HUP -u $user");
+ }
+ system("pkill -9 -u $user");
system("userdel $user") == 0
or die "userdel of $user failed: $?\n";