Hi All,
I am working on a Solaris 10 machine and now working with a user creation script. I want to create users using the script and assign a default password.
I found the use of 'expect' in one post, but 'expect' is not available in our server.
Also, the below code is not working for me.
# useradd -m -d /home/foo foo
# echo "foo" | passwd --stdin foo
Changing password for user foo.
passwd: all authentication tokens updated successfully.
Now I am thinking of editing the /etc/shadow file with the password string of other user. But I am really afraid to try this way as our servers are live having 100+ users. can anyone suggest if editing the /etc/shadow file using the below 'sed' command will work?
passwd=crypted_passwd
sed "s/${name}/${name}:${passwd}/" /etc/shadow > /tmp/shadow.tmp
cp /tmp/shadow.tmp /etc/shadow
rm /tmp/shadow.tmp
Or Can you help me with a new way of doing it?
Thanks in advance.
Jaise