summaryrefslogtreecommitdiff
path: root/lib/Vyatta
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Vyatta')
-rwxr-xr-xlib/Vyatta/Login/User.pm5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Vyatta/Login/User.pm b/lib/Vyatta/Login/User.pm
index 5280a4a1..b0c0381c 100755
--- a/lib/Vyatta/Login/User.pm
+++ b/lib/Vyatta/Login/User.pm
@@ -167,7 +167,12 @@ sub update {
warn "Disabling root account, instead of deleting\n";
system ('sudo usermod -p ! root') == 0
or die "usermod of root failed: $?\n";
+ } elsif (getlogin() eq $user) {
+ die "Attempting to delete current user: $user\n";
} else {
+ # This logs out user
+ system("sudo pkill -u $user");
+
system("sudo userdel -r '$user'") == 0
or die "userdel of $user failed: $?\n";
}