Browse Source

provision.pl - added user creation prompt because vultr

master
gashapwn 3 years ago
parent
commit
8cfc3140cc
1 changed files with 9 additions and 1 deletions
  1. +9
    -1
      perl-script/provision.pl

+ 9
- 1
perl-script/provision.pl View File

@@ -35,7 +35,15 @@ if($pwuid ne "root"){
if( ($admin_un) = `tail /etc/passwd | grep -v "nobody:"` =~ /([^:\n]+):[^:]+:[0-9]{4,}/){
printf("admin user will be set to %s\n", $admin_un);
}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";


Loading…
Cancel
Save