change ports through CLI


I am making an automated script to run on a newly installed server to set security and basic applications in a quick fashion.

In the script I will allow the possibility to run an install of Virtualmin. However, as a default policy, I do not run virtualmin or usermin on the default ports.
I will want to create the firewall file before Virtualmin is created and need to be able to change the Virtualmin and usermin ports after the install.

I found the following file: /etc/webmin/miniserv.conf which shows me the ports I set for Virtualmin. Is this the only place where I need to alter the ports for Virtualmin, or are there more files?
How about the Usermin ports? Where can I alter those?

Thanks a lot for your help :slight_smile:

Using some empiric tests (change the port number thru the GUI and then grep for the new one in /etc :slight_smile: ), I found out:

The main port for Virtualmin/Webmin is in /etc/webmin/miniserv.conf, entry “port”. The other entry with the default port 10000, “listen”, applies to the UDP broadcast “search for Webmins” function.

The port for Usermin is in /etc/usermin/miniserv.conf, entry “port”.

Those should be the only locations.

Locutus is correct, just change the port numbers in those two files and restart the applicable services.

Great Thanks :slight_smile:
I’ll post the script once it’s finished. It should cut off a few hours of initial server configuration for security…