Virtualmin and Webmin uses port 10000 as its default access port. Being the default setting for all fresh installations make port 10000 vulnerable to attacks. But fortunately there is an easy method to change port to an uncommon port and harden the security of your Virtualmin server.
Changing default access port of Virtualmin is the first thing you must do after building your server with Virtualmin. Port 10000 is heavily targeted by hackers to gain access to Virtualmin server. Of course they can’t get in without the correct password, but sometimes some of them gets through. So it’s best to prepare for the worst.
Hackers have this tiny opportunity because they know which port Virtualmin is listening to. If you change this port to an uncommon one, it’ll be impossible to launch brute force attacks against Virtualmin. That is what exactly we’re going to do. You can watch the video tutorial found on the top of this page for virtual walk-through. I’ll write down instructions below for people who don’t like video tutorials.
You can start by login into Virtualmin on default port as root user. Once inside, go to Webmin > Webmin Configuration. And then click Ports and Addresses. You’ll land on the page you can change IP addresses and ports Virtualmin and Webmin listen to. You can configure a single IP address for Virtualmin to listen to if you have multiple IP addresses allocated to your server. That’s a post for another day. I’ll just show you how to change default port for this tutorial.
You’ll see port 10000 listed under Listen on IPs and ports and Listen for broadcasts on UDP port. Change it to your port number of choice. I use 10685 for this tutorial. So my changes look like this.
Click Save to save changes. You’ll be automatically redirected to the new port. Virtualmin won’t be available on port 10000 anymore. Now if you have firewall enabled on your server, you should open new port so you can connect to Virtualmin. Following command will open port 10685 on my server. You need to be logged into your server over SSH to run this command.
ufw allow 10685
Change the port number on above command accordingly. And it’s a good idea to close the port 10000 with firewall if it’s already open. Following command will take care of that.
ufw deny 10000
That’s it. You should be able to access Virtualmin on your new port if you had problems earlier. Feel free to leave a comment if you have trouble changing Virtualmin default port.