diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-12-18 11:15:39 -0800 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-12-18 11:15:39 -0800 |
commit | 42144158c9036f4801289905a316de4a2b7a772e (patch) | |
tree | 77583fbefd981744c30c5f6307ab24d5a95bd02c | |
parent | 0a79c8a523bf8646ce52ffdc8aa61179a2a31a20 (diff) | |
download | vyatta-cfg-system-42144158c9036f4801289905a316de4a2b7a772e.tar.gz vyatta-cfg-system-42144158c9036f4801289905a316de4a2b7a772e.zip |
User deletion update
1. Allow deleting user still logged in (Bug 5067)
2. Don't allow deleting self, because that would mean killing current
process.
-rwxr-xr-x | lib/Vyatta/Login/User.pm | 5 |
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"; } |