A program called changepass.pl is included in the Webmin distribution precisely to solve this problem.
Look for a file called changepass.pl in the webmin directory or just try a system wide find if you are not sure about the webmin directory on your server.
The command find / -name changepass.pl will find the location of changepass.pl on your server and will search system wide.
You will require the path of the webmin configuration files on your server, usually it is in /etc/webmin directory.
So the syntax is
Assuming that Webmin is installed in /usr/libexec/webmin, configuration directory /etc/webmin , we can change the password of the ‘admin’ user to ‘fooooo’ by executing
/usr/libexec/webmin/changepass.pl /etc/webmin admin fooooo