This post solves the problem when you have forgotten the root password of webmin or virtualmin and can’t login to the webmin or virtualmin admin panel at all.
This process will require ssh access to your server.
How to reset virtualmin / webmin root password
This example process is tested on a virtual machine hosted on google cloud console, by using GCC on-site SSH.
Before we begin, you might have to change to superuser using this command in SSH terminal:
sudo su
We can not recover the old password by this method. But we can set a new password very easily. Follow these steps to reset your virtualmin / webmain password:
- Login to SSH (you can go to your google cloud console > VM Instances > click SSH button next to your instance
- run this command in SSH terminal (change NEWPASSWORD to your new password that you want to use) – you can also change the username from root to any user you want to reset password for:
For RHEL/CentOS:
/usr/libexec/webmin/changepass.pl /etc/webmin root NEWPASSWORD
For Debian/Ubuntu
/usr/share/webmin/changepass.pl /etc/webmin root NEWPASSWORD
For Thecus NAS
alias webmin-pass='/raid0/data/module/WebMin/sys/bin/changepass.pl /raid0/data/module/WebMin/sys/etc/webmin admin'
alias webmin-restart='/raid0/data/module/cfg/module.rc/WebMin.rc stop | /raid0/data/module/cfg/module.rc/WebMin.rc start'
Now your password is reset.
Now you can goto your webmin or virtualmin admin panel and can login using the newly created password for the user root.