To improve the security on my linux centOS server, it is recommended to change the default port of the service and change it to custom webmin’s port number. In this post i will show you on how to modify the default port, 10000 to 10101.
Check default port number :
[root@CentOS57 ~]# netstat -plunt | grep perl
tcp 0 0 0.0.0.0:10000 0.0.0.0:* LISTEN 4521/perl
udp 0 0 0.0.0.0:10000 0.0.0.0:* 4521/perl
Where is the webmin port number stored?
Webmin port number store in /etc/webmin/miniserv.conf
To modify the default port, 10000 to 10101, open the /etc/webmin/miniserv.conf file and modify line 1 and 16.
1 port=10101
..
..
16 listen=10101
..
Sample configuration file :
[root@CentOS57 ~]# vi /etc/webmin/miniserv.conf
port=10101
root=/usr/local/webmin
mimetypes=/usr/local/webmin/mime.types
addtype_cgi=internal/cgi
realm=Webmin Server
logfile=/var/webmin/miniserv.log
errorlog=/var/webmin/miniserv.error
pidfile=/var/webmin/miniserv.pid
logtime=168
ppath=
ssl=0
env_WEBMIN_CONFIG=/etc/webmin
env_WEBMIN_VAR=/var/webmin
atboot=1
logout=/etc/webmin/logout-flag
listen=10101
denyfile=\.pl$
log=1
blockhost_failures=5
blockhost_time=60
syslog=1
session=1
premodules=WebminCore
server=MiniServ/1.570
userfile=/etc/webmin/miniserv.users
keyfile=/etc/webmin/miniserv.pem
passwd_file=/etc/shadow
passwd_uindex=0
passwd_pindex=1
passwd_cindex=2
passwd_mindex=4
passwd_mode=0
preroot=blue-theme
passdelay=1
Restart webmin service using this command:
[root@CentOS57 ~]# /etc/webmin/restart
Stopping Webmin server in /usr/local/webmin
Starting Webmin server in /usr/local/webmin
Pre-loaded WebminCore
Check the modified webmin’s port number
[root@CentOS57 ~]# netstat -plunt | grep perl
tcp 0 0 0.0.0.0:10101 0.0.0.0:* LISTEN 4750/perl
udp 0 0 0.0.0.0:10101 0.0.0.0:* 4750/perl
Now you can access the Webmin through url with new custom port.
http://serverip:10101