To change a password in Linux through a Bash script, he two scripts that are most important are 'Create Users' and 'Change Passwords Shell' scripts, for the system admin which regularly uses the mail servers, as there might be multiple functionalities associated with the admin job. If there is a failure to backup the admin's system username and password, it hampers other admin tasks and chances of password misappropriation are high. If you lose the usernames and passwords of the mail server, the admin has to manually create all the users again and then change the passwords for all of them. There are two methods to change passwords on the system if you are using the Linux operating system .The conventional command is passwd, -stdin, pipe. One more option that can be used is the chpasswd.
echo -e "new_password\nnew_password" | (passwd --stdin $USER)
echo "password:name" | chpasswd
echo -e "new_password\nnew_password" | (smbpasswd -a -s $USER)