From 116cf850c2fdb2dba6489e0e7148ed4de08a3c6a Mon Sep 17 00:00:00 2001 From: Adrian Chadd Date: Wed, 2 May 2001 13:20:12 +0000 Subject: Extend adduser to create "locked" accounts. Adduser can now lock an account at creation, create accounts with a "*" password (so you can use alternate authentication schemes without fearing a "default" password biting you later), and blank passwords. Yes, adduser could create a blank password account, but this makes it slightly more difficult to shoot yourself in the foot. The /etc/adduser.conf entries are: # use password-based authentication for new users # defaultusepassword = "yes" | "no" defaultusepassword = "yes" # enable account password at creation # (the password will be prepended with a star if the account isn't enabled) # defaultenableaccount = "yes" | "no" defaultenableaccount = "yes" # allow blank passwords # defaultemptypassword = "yes" | "no" defaultemptypassword = "no" Requested by: alfred Reviewed by: alfred --- adduser/adduser.perl | 152 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 137 insertions(+), 15 deletions(-) (limited to 'adduser') diff --git a/adduser/adduser.perl b/adduser/adduser.perl index f453207..e70349c 100644 --- a/adduser/adduser.perl +++ b/adduser/adduser.perl @@ -30,7 +30,9 @@ # read variables sub variables { $verbose = 1; # verbose = [0-2] - $defaultpasswd = "yes"; # use password for new users + $defaultusepassword = "yes"; # use password authentication for new users + $defaultenableaccount = "yes"; # enable the account by default + $defaultemptypassword = "no"; # don't create an empty password $dotdir = "/usr/share/skel"; # copy dotfiles from this dir $dotdir_bak = $dotdir; $send_message = "/etc/adduser.message"; # send message to new user @@ -65,6 +67,9 @@ sub variables { $pwgid = ''; # $pwgid{pwgid} = username; gid from passwd db $password = ''; # password for new users + $usepassword = ''; # use password-based auth + $useemptypassword = ''; # use an empty password + $enableaccount = ''; # enable or disable account password at creation # group $groupname =''; # $groupname{groupname} = gid @@ -522,11 +527,24 @@ sub new_users_groups_valid { # your last change sub new_users_ok { + local ($newpasswd); + # Note that we either show "password disabled" or + # "****" .. we don't show "empty password" since + # the whole point of starring out the password in + # the first place is to stop people looking over your + # shoulder and seeing the password.. -- adrian + if ($usepassword eq "no") { + $newpasswd = "Password disabled"; + } elsif ($enableaccount eq "no") { + $newpasswd = "Password disabled"; + } else { + $newpasswd = "****"; + } print <