Deprecated: Function create_function() is deprecated in /home2/blogwebhostingbu/public_html/wp-content/plugins/facebook-like-box-responsive/facebook-like-box.php on line 29
Manage cPanel mail forwarders via SSH - WebHostingBuzz US Blog
Notice: Undefined variable: defaults in /home2/blogwebhostingbu/public_html/wp-content/plugins/fatpanda-facebook-comments/plugin.php on line 366
 

Manage cPanel mail forwarders via SSH

Posted on 23 Mar 2011 by Alan Burns

In an earlier article I described how mail forwarders work. They are a useful feature. So much so that some of us have long lists of forwarders for our domains.

Creation and editing of mail forwarders is normally handled via cPanel’s web interface. Those of us with long lists, though, now find it awkward due to a change made by cPanel developers to sub-divide long lists of items such as mail forwarders into multiple pages, as detailed in an earlier article.

If you have VPS (virtual private server) hosting plan, you might prefer to directly edit the file containing the forwarders. This can be achieved via an SSH connection. For security purposes, SSH may by default be disabled on your server, so you may need to request SSH access from your host.

Once logged in to your VPS as root, over SSH, change directory to etc/valiases/ :

cd /etc/valiases/

In valiases you should see several files, one per domain. If you cannot find that directory, then ask your host, as configuration does vary somewhat, thought that is the most common path.

Use Midnight commander (‘mc’ command), ‘vi’ or ‘nano’ commands to edit those files. To create a forwarder, add lines in this format:

myaccount@domain.com: myaccount@gmail.com, myaccount@yahoo.com
*: :fail: No Such User Here

The last line is necessary to avoid delivery to non-existent mail accounts and addresses.

Root access is one of the many advantages of a VPS hosting plan. It provides more control, more features, and ways to directly access files that are often faster than using the cPanel GUI.

WebHostingBuzz Logo

© WebHostingBuzz USA LLC 2002 - 2024
WebHostingBuzz is a Registered Trademark.
All Rights Reserved.
WebHostingBuzz USA LLC, 850 Southbridge Street, Auburn, MA 01501, USA

1 (800) 252-1887

Payment Logos
  • Webmoney Verified
  • Webmoney Accepted

Sign up for our Newsletter

Scroll to Top