I noticed when I was logged into the webmail interface the other day that there are some icons and options that appear to logged-in users that I really don’t want my end users to be fooling with. Not that they are dangerous per se, but they would raise more questions than they would provide answers and I’d just prefer them not there. With end users on webmail, I like to follow the K.I.S.S. principle.
So, I came up with the following way to remove any unwanted options from the cPanel webmail interface screen so that the user cannot choose them (or ask about them). It’s a very simple fix and it doesn’t actually turn the functions off, it just makes them invisible to the end user.
(NOTE: If you all you want to do is to prevent one or more of the built-in webmail programs (Horde, Roundcube, etc.) from being used, you should disable those directly from within WHM (root user only); they will then automatically disappear from the webmail menu without needing to do any of this below. Those options can be found at Server Configuration >> Tweak Settings >> Mail )
REMOVING OPTIONS FROM THE WEBMAIL MENU
1. LOG IN using SSH as ROOT to your server.
2. Run this command to create a backup of the current file before editing (this should all on one line):
cp /usr/local/cpanel/base/webmail/x3/index.html /usr/local/cpanel/base/webmail/x3/index.bak
3. Open the necessary file for editing:
nano /usr/local/cpanel/base/webmail/x3/index.html
4. Now comes the time for you to remove the options you don’t want to appear – by using an HTML comment tag to take those sections out. Almost every item (with one exception) that you might want to remove is enclosed in <cpanelfeature> tags in the index.html file. There will be a line like <cpanelfeature nameoffeature> and then, a few lines down, a closing tag like </cpanelfeature>. To remove a feature, simply comment out the entire section using HTML tags (i.e., <!– and –> ) at the beginning and end of the unwanted section; for example, like this:
ORIGINAL FILE:
<cpanelfeature traceaddy>
<td>
<div valign=”top” align=”center”>
…etc.
…etc.
…etc.
</cpanelfeature>
SAME SECTION COMMENTED OUT TO REMOVE THE FEATURE:
<!– <cpanelfeature traceaddy>
<td>
<div valign=”top” align=”center”>
…etc.
…etc.
…etc.
</cpanelfeature> –>
For your convenience here’s a list of the features tags I found in the file so you can easily find them yourself and comment out those sections you don’t want:
<cpanelfeature webmail> = Displays Available Webmail Apps for login
<cpanelfeature popaccts> = Change Password Option
<cpanelfeature forwarders> = Email Forwarders (a.k.a “Forwarding Options”)
<cpanelfeature autoresponders> = Auto Responders
<cpanelfeature boxtrapper> = Box Trapper Configuration
<cpanelfeature traceaddy> = Email Route (Trace Email)
<cpanelfeature blockers> = User Filters (a.k.a. “Email Filtering”)
…and (the exception I mentioned above) if you want to remove the “Configure Webmail Client” option, there is no <cpanelfeature> tag, so you’ll need to look for and comment out the section that looks like this:
<td>
<div valign=”top” align=”center”>
<a href=”mail/clientconf.html…. etc.
</div>
</td>
5. After you’ve commented out all the sections you don’t want to show, simply SAVE AND EXIT the file you were editing. The changes will be visible immediately; just log in to the cPanel webmail interface to test it.
RECOVERY
If anything goes horribly wrong when you make your changes, just do this:
rm /usr/local/cpanel/base/webmail/x3/index.html
and then (all on one line):
cp /usr/local/cpanel/base/webmail/x3/index.bak /usr/local/cpanel/base/webmail/x3/index.html
This will restore the backup you made in step 2 above.
NOTES
1. This technique assumes that your end-user is using the x3 cPanel theme. If they are using a different theme, you’ll need to follow these steps on the index.html file in the appropriate theme subdirectory under /usr/local/cpanel/base/webmail instead. To be safe, you could go ahead and edit all of the themes under that directory, but that may be a bit overkill depending on your situation.
2. These changes you’ve made could very well be overwritten on a subsequent cPanel upgrade, so you should check this file every time cPanel is upgraded to be sure your changes haven’t been overwritten. There are ways to stop cPanel from updating this file (in fact, I’ll be posting about just such a trick tomorrow), but I usually don’t want to do anything to cPanel that could possibly cause it to stop functioning properly in the future should the file be significantly modified.
3. I want to point out again that these changes simply remove the icon from the webmail interface screen for your users; it DOES NOT disable the function. A tech-savvy end user could very well just type the direct URL to the necessary function into the URL bar of his browser and the function will be served to him without notice. However, this technique should be effective for at least 95% of the general population. Actually stopping the function from being used is beyond the scope of this post.
Have you made similar modifications to your user’s webmail screens? Have an easier or better technique? Let us know by posting a comment below!
Great topic, I hate not feeling in total control of my systems, especially when I am paying for them.
I got tired of seeing all the promotional options and other useless “features” from the hosts that use cPanel. These items can also be removed by a similar method.
is it possible to edit this index.html outside of SSH? For example, can I access it via Cpanel gui file manager?
Unforunately, no. The file exists outside of the area of the filesystem that the cPanel GUI file manager allows access to. This is for security reasons as you wouldn’t want your cPanel users to be able to mess around with the important files that exist outside of their home directories.