provision.pl - added user creation prompt because vultr

This commit is contained in:
gashapwn 2020-12-20 01:59:38 +00:00
parent ba9ba47081
commit 8cfc3140cc

View File

@ -35,7 +35,15 @@ if($pwuid ne "root"){
if( ($admin_un) = `tail /etc/passwd | grep -v "nobody:"` =~ /([^:\n]+):[^:]+:[0-9]{4,}/){ if( ($admin_un) = `tail /etc/passwd | grep -v "nobody:"` =~ /([^:\n]+):[^:]+:[0-9]{4,}/){
printf("admin user will be set to %s\n", $admin_un); printf("admin user will be set to %s\n", $admin_un);
}else{ }else{
die "create a non-root user & set user passsword before running this script." printf("need a non-root user...\n");
printf("want to create a user? Y/N\n");
unless(<STDIN> eq "Y\n"){
die "create a non-root user & set user passsword before running this script.";
}
printf("Username: ");
$admin_un = <STDIN>;
chomp $admin_un;
`useradd -m $admin_un`;
} }
$admin_home_dir = "/home/$admin_un"; $admin_home_dir = "/home/$admin_un";