0

I know this is an old topic but I am struggling to find an answer.

Every 4 months I have to create 150 new users with a password, and have them added to default groups with a working home directory every 4 months.

But this command

sudo adduser testuser02 --disabled-password && sudo passwd testuser02 testpassword02

stops and asks questions for Full Name, Room Number, Work Phone, Home Phone, Other and "Is the information correct?"

Having to press ENTER six times is not how I want to do this!

Also the passwd command fails.

I want to use adduser because it creates the home folder and groups (access permissions) properly.

I know useradd does a similar thing but I am struggling to make it do what I need.

muru
  • 193,181
  • 53
  • 473
  • 722
skris88
  • 1
  • 1
  • Why again do you need to create exactly 150 users every four months. That seems like a bit of an odd task – cocomac Dec 03 '21 at 01:03
  • Welcome to AskUbuntu, https://askubuntu.com/questions/94060/run-adduser-non-interactively this answer does it without asking questions. – Sadaharu Wakisaka Dec 03 '21 at 01:07
  • Thanks, please close this request. We are a training organisation with a 3 month long course and have about 150 new remote students every time; and - anyway - the command is: username=test4 && password=test4 && sudo adduser --gecos "" --disabled-password $username && sudo chpasswd <<<"$username:$password" which I script via a spreadsheet with each student's login ID being their firstname.lastname and their login PW being set to FirLasDDMM eg. Jill Smith born 12/29 PW will be JilSmi2912 - and there is pre-verification on the spreadsheet that there are no duplicates of IDs or PWs. – skris88 Dec 06 '21 at 05:59

0 Answers0