I'm attempting to write a small test script to take two variables (user name and password) from user input, encrypt the password variable then add the user to the linux system using useradd -p. The usage for useradd -p requires a password already encrypted with crypt(), however I am unsure of the usage for crypt (even after reading the man page). Could anybody offer any advice please?
I believe the script should look something like this (which doesn't work!) :
echo "Enter user : "
echo "Enter password : "
useradd -p $ENCRYPTEDPASS $USER
Thanks in advance.