Hi all,
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!) :
Code:
#!/bin/bash
echo "Enter user : "
read USER
echo "Enter password : "
read PASS
ENCRYPTEDPASS=crypt($PASS)
useradd -p $ENCRYPTEDPASS $USER
exit
Thanks in advance.