Useradd and password in single line
I am trying to create some users in linux using bash script, I want to give password along with the user add command. -p / –password option is allowing enter the password. but only in encripted format. If it is not prompting for a password i can create a script to create multiple users in a linux server
Can any one help me to do this with a plain text.
Following command will help you to do this in single line. you can create a bashscript using for loop command by asigning a variable for password
User : john
password : 1234
#useradd john; echo 1234 | passwd –stdin john
Was this answer helpful?
LikeDislikeAbove mentioned is a plain text method. You can use an encriptod method, find below command
#useradd && echo username:password | chpasswd –crypt-method=SHA512
Was this answer helpful?
LikeDislike