diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-03-15 09:17:46 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-03-15 09:17:46 -0700 |
commit | 87c0562ee477ebc37248c00cdcfe93ecfcf31102 (patch) | |
tree | b6cac8db0f69bb89a5d16060a29074fcc9d73e56 | |
parent | 47e3b415c8f3d4544ccc62755369985ca70d6c5f (diff) | |
download | vyatta-cfg-system-87c0562ee477ebc37248c00cdcfe93ecfcf31102.tar.gz vyatta-cfg-system-87c0562ee477ebc37248c00cdcfe93ecfcf31102.zip |
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.
-rwxr-xr-x | lib/Vyatta/Login/User.pm | 7 |
1 files changed, 1 insertions, 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"; } } |