NRockhouse's Blog

How to Hide IP Address in “Recent Logins” Panel of Webmin

Webmin is a web-based interface for system administration for Unix. There might be reasons why you would want to hide these details, for example you’re sharing a single VPS instance with a team and you don’t want other members to know each other’s IP address. Whatever the reason, I don’t like how it kinda violates my privacy to other users of the system, so here’s how you hide it by editing the Perl code itself. Do note that you have to have access to the system where you hosted Webmin.

Firstly, login into your system via SSH or Telnet. Change your working directory to /usr/libexec/webmin (unless if you installed it somewhere else, change it into the directory). Then, change your directory into the folder acl. Edit system_info.pl with your favourite editor (nano / vim).

Search for this part:

foreach my $k (keys %sessiondb) {
	next if ($k =~ /^1111111/);
	next if (!$sessiondb{$k});
	my ($user, $ltime, $lip) = split(/\s+/, $sessiondb{$k});
	next if ($user ne $remote_user && $user ne "!".$remote_user);
	push(@logins, [ $user, $ltime, $lip, $k ]);
	}

Edit the $ltime and $lip in the push function to hide the login time and login IP from the “Recent Logins” pane.

foreach my $k (keys %sessiondb) {
	next if ($k =~ /^1111111/);
	next if (!$sessiondb{$k});
	my ($user, $ltime, $lip) = split(/\s+/, $sessiondb{$k});
	next if ($user ne $remote_user && $user ne "!".$remote_user);
	push(@logins, [ $user, "0", "0.0.0.0", $k ]);
	}

You should see your changes instantly after refreshing the Webmin page in your browser. (You don’t need to restart Webmin)

However, take note that this edit solely HIDES the IP and login time from the web control panel, it does not stop the logging of these information and it is still retrievable by downloading the session log from the system.

If you want to clear it, try this instead: https://www.virtualmin.com/node/41882

Unfortunately, it didn’t work for me, so I edit the Perl script instead. I have no knowledge of scripting in Perl as of this writing, so try this at your own risk, and point out my mistakes in the comments if there’s any. If anybody found a way to stop the logging, do comment as well and I’ll update the solution into this article along with credits to you.

Advertisements by PropellerAds

Leave a Reply

Your email address will not be published. Required fields are marked *

www.000webhost.com