View Single Post
  #1   (View Single Post)  
Old 12th December 2010
wesley wesley is offline
Real Name: Wesley
Shell Scout
Join Date: Aug 2009
Location: Reunion Island
Posts: 91
Default script add user with encrypted password


I try to write a batch file to add a user or multiple users with encrypted passwords in the batch.

What i have done :
encrypt yeti
give me -> $2a$06$dY6sS5vY1l7xD/CXHH2ezuMK5TVUiqEkmDvYUBJct9/Zfksjcm97C

So i try it in my batch :
useradd -c "YETI" -d /home/yeti -m -s /bin/ksh \
-p $2a$06$dY6sS5vY1l7xD/CXHH2ezuMK5TVUiqEkmDvYUBJct9/Zfksjcm97C \
-G users,wheel yeti

The problem, when i launch the batch file, shell give me the value of $2 of my encrypted password, how can i fix it ?
Reply With Quote