Article 53KQA Automate user creation and password via script

Automate user creation and password via script

by
bigred_247
from LinuxQuestions.org on (#53KQA)
Hi,
I'm trying to automate user creation and password insertion via a script but need some help. I am able to manually do the following:

sudo adduser johndoe
sudo passwd johndoe
and then at the password prompt add the password

Is there a way i can automate this in my shell script? and does the password have to be clear text or is there a way to hide this? FYI, I am using Amazon Linux 2. I'm pretty new to Linux so any help will be much appreciated.

Thanks.latest?d=yIl2AUoC8zA latest?i=kTUQ7zOxi4o:H4Y6BTHuRJE:F7zBnMy latest?i=kTUQ7zOxi4o:H4Y6BTHuRJE:V_sGLiP latest?d=qj6IDK7rITs latest?i=kTUQ7zOxi4o:H4Y6BTHuRJE:gIN9vFwkTUQ7zOxi4o
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments