Introduction:
Webmin and Usermin are web-based control panel that simplify server and user account management. To enhance the security of your system, it’s advisable to change the default ports for Webmin (usually 10000) and Usermin (usually 20000). Altering these ports adds an extra layer of protection, making it more difficult for potential intruders to access your server. This tuturial guides you through the step-by-step process of changing the default ports for Webmin and Usermin, along with configuring your firewall settings for seamless connectivity.
Why Change Webmin and Usermin Ports?
Changing the default ports for Webmin and Usermin (commonly 10000 and 20000, respectively) enhances the security of your server. Default ports are well-known to attackers, and modifying them adds an element of obscurity to your system. This deters automated bots and malicious actors from exploiting vulnerabilities associated with standard port configurations, providing an additional safeguard for your server.
Step 1: Connect to Your Server:
Start by connecting to your server using your preferred terminal or SSH client. Log in with your administrative credentials.
ssh username@your_server_ip
Replace “username
” with your actual username and “your_server_ip
” with your server’s IP address.
Step 2: Locate the Webmin Configuration File:
Navigate to the directory where the Webmin configuration file is stored. This file is commonly found at:
/etc/webmin/miniserv.conf
Step 3: Open the Webmin Configuration File:
Use a text editor to open the Webmin configuration file. You can use Nano, Vim, or any other editor you are comfortable with. For example, with Nano:
sudo nano /etc/webmin/miniserv.conf
Step 4: Locate the ‘port’ and ‘listen’ Line:
Within the configuration file, locate the line that starts with ‘port.’ and ‘listen’ The default port is typically set to 10000. Change this number to your desired port, ensuring it falls within the unprivileged port range (1024-65535) and is not already in use.
For example:
port=12345
Step 5: Save and Close the File:
After modifying the port number, save the changes and close the text editor. In Nano, you can do this by pressing Ctrl + X
, then Y
to confirm the changes, and finally, Enter
to exit.
Step 6: Restart Webmin:
To apply the changes, restart the Webmin service:
sudo service webmin restart
or
sudo systemctl restart webmin
Next, follow the same steps to change the port for Usermin:
Step 7: Locate the Usermin Configuration File:
Navigate to the directory where the Usermin configuration file is stored. This file is commonly found at:
/etc/usermin/miniserv.conf
Step 8: Open the Usermin Configuration File:
Use a text editor to open the Usermin configuration file:
sudo nano /etc/usermin/miniserv.conf
Step 9: Locate the ‘port’ and ‘listen’ Line:
Within the configuration file, locate the line that starts with ‘port.’ and ‘listen’ The default port is typically set to 20000. Change this number to your desired port, ensuring it falls within the unprivileged port range and is not already in use.
For example:
port=23456
Step 10: Save and Close the File:
After modifying the port number, save the changes and close the text editor.
Step 11: Update Firewall Settings:
To ensure seamless connectivity, update your firewall settings to allow traffic on the new Webmin and Usermin ports. Use the following commands based on your firewall tool:
For UFW (UFW is commonly found on Ubuntu and Debian systems):
sudo ufw allow [your_webmin_port]/tcp sudo ufw allow [your_usermin_port]/tcp
For iptables:
sudo iptables -A INPUT -p tcp --dport [your_webmin_port] -j ACCEPT sudo iptables -A INPUT -p tcp --dport [your_usermin_port] -j ACCEPT
For firewalld (firewalld is commonly found on CentOS and Rocky Linux systems):
sudo firewall-cmd --add-port=[your_webmin_port]/tcp --permanent sudo firewall-cmd --add-port=[your_usermin_port]/tcp --permanent sudo firewall-cmd --reload
Ensure you replace “[your_webmin_port]” and “[your_usermin_port]” with the actual ports you selected.
Step 12: Restart Usermin:
To apply the firewall changes, restart the Usermin service:
sudo service usermin restart
or
sudo systemctl restart usermin
Conclusion:
Changing the default ports for Webmin and Usermin is a simple process that contributes to the overall security of your server. By customizing these ports, you reduce the visibility of potential entry points, making it more challenging for unauthorized users to compromise your system. Follow these steps to ensure your Webmin and Usermin panels operate on your chosen ports, bolstering the defenses of your server against potential threats. Always verify that the new ports are allowed through your firewall to maintain seamless connectivity.