From 87c0562ee477ebc37248c00cdcfe93ecfcf31102 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 15 Mar 2010 09:17:46 -0700 Subject: Use userdel -f to force removal of user This is the documented way to remove user that is still logged in. It also removes home directory, which is necessary as well. --- lib/Vyatta/Login/User.pm | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/Vyatta/Login/User.pm b/lib/Vyatta/Login/User.pm index a65e5cb1..edba13ac 100755 --- a/lib/Vyatta/Login/User.pm +++ b/lib/Vyatta/Login/User.pm @@ -109,12 +109,7 @@ 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 -HUP -U $user"); - sleep(1); - system("pkill -9 -U $user"); - - system("userdel $user") == 0 + system("userdel -f $user") == 0 or die "userdel of $user failed: $?\n"; } } -- cgit v1.2.3