using the crypt command in my script
Hey. it'sbeen a while since I've logged here. I'm still working on the automated useradd script, and I've run into a snag, but let me recap my project, and my status before I go into that.
The script I'm doing right now requires me to automatically add in users based on information provided from a text file including userid, user id number, groups(multiple) . This part is no problem. thanks to the fine help I've received here, that I can do without problem. However, another thing that needs to be done for this script is to add an encrypted password based on the password provided in the text file. This is my snag.
Here is my script thus far:
the problem here is the password. I know useradd has a -p option, but it doesn't have encryption. the project states the password needs to be encrypted. My instructor has hinted at using the crypt command to encrypt the password. The thing is, I've no idea how to use crypt, and where it would fit into my script for the password. $pass is the password variable and it has to be read from the cat statement, there can't be any user input. it all has to be automated.[/code]
cat inputfile.txt | while read usrname name uid pass groups
useradd $usrname -c $name -m -G $groups -u $uid