I found a guide that explains how to set a user's password. I'm trying to automate it and send an e-mail to the user like:
userid created with password XYZ. request to change the initial password.
According to the doc above, an encrypted password needs to be created using Python and fed to the
usermod command like this:
usermod -p "<encrypted-password>" <username>
Are there any other simpler ways to do this? I don't want to download any special utility to do it; it should be generalized as much as possible.
Edit: Even the method given in the above link doesn't seem to work for me:
bash-3.00# python Python 2.4.6 (#1, Dec 13 2009, 23:43:51) [C] on sunos5 Type "help", "copyright", "credits" or "license" for more information. >>> import crypt; print crypt.crypt("<password>","<salt>") <sOMrcxm7pCPI >>> ^D bash-3.00# useradd -g other -p "sOMrcxm7pCPI" -G bin,sys -m -s /usr/bin/bash mukesh2 UX: useradd: ERROR: project sOMrcxm7pCPI does not exist. Choose another. UX: useradd: sOMrcxm7pCPI name should be all lower case or numeric.