Get a Pentest and security assessment of your IT network.

Cyber Security

Add Email Forwarder via Command Line

TL;DR

Yes, you can add an email address to a cPanel account’s forwarders list without using the cPanel interface. This is done through SSH access and command-line tools.

How to Add an Email Forwarder Without cPanel Access

  1. Access Your Server via SSH: You’ll need Secure Shell (SSH) access to your web hosting server. Use a terminal application (like Terminal on macOS/Linux or PuTTY on Windows). Connect using your username and password, or an SSH key.
    ssh [email protected]
  2. Identify the Account: Determine the cPanel account you want to modify. If you have multiple domains hosted on the server, you may need to specify which account’s email forwarders you are changing.
  3. Use the /usr/local/cpanel/bin/forwarder script: This is the primary tool for managing email forwarders from the command line.

    The basic syntax is:

    /usr/local/cpanel/bin/forwarder --add [email protected] [email protected]
    • Replace user with the username of the cPanel account.
    • Replace yourdomain.com with the domain name associated with the account.
    • Replace [email protected] with the email address you want to forward messages to.
  4. Example: To add a forwarder for [email protected] forwarding to [email protected], use:
    /usr/local/cpanel/bin/forwarder --add [email protected] [email protected]
  5. Verify the Forwarder: You can verify that the forwarder has been added using the command line:
    /usr/local/cpanel/bin/forwarder --list [email protected]

    This will output a list of all existing forwarders for the specified account.

  6. Error Handling: If you encounter errors, check:
    • That the username and domain name are correct.
    • That the destination email address is valid.
    • Your server’s permissions; you may need root access for certain operations (though this script generally works within user accounts).

Important Note: Always be careful when using command-line tools, as incorrect commands can have unintended consequences. Back up your data regularly.

Related posts
Cyber Security

Zip Codes & PII: Are They Personal Data?

Cyber Security

Zero-Day Vulnerabilities: User Defence Guide

Cyber Security

Zero Knowledge Voting with Trusted Server

Cyber Security

ZeroNet: 51% Attack Risks & Mitigation