Last updated 8 months ago
In order to change in shell scripts, we have two options which are given below.
Using passwd
passwd
$ echo -e "{NEW_PASSWORD}\n{NEW_PASSWORD} | passwd {USER}
Using chpasswd
chpasswd
$ echo "{USER}:{NEW_PASSWORD} | chpasswd
Source: