echo passwd | passwd user --stdin
if you have many user, need to reset password , create a file (id) with all user names and --
for i in `cat id`
do
echo $i
echo 123789 | passwd $i --stdin
sleep 1
done
This will set password to 123789 for all the users lists in the file (id).
***
ReplyDeletei can't understand
ReplyDeleteeg_ a user named "vikas" is there
ReplyDeleteNow to change its password You will use passwd command, which will prompt for new password as below
$ passwd vikas
New UNIX password:
BAD PASSWORD: it is too simplistic/systematic
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
Now do this in one line
$ echo ur_passwd | passwd user_name --stdin
i.e
echo 123654 | passwd vik_user --stdin
Now script if you have many user, write them in a file.
Read each user from file and reset their passwd.