Fix “Permission denied” Error When Adding an Email Forwarder

Overview

When adding an email forwarder in cPanel, you may encounter a permission-related error that prevents the system from updating the domain’s aliases file.

Error Message

Error opening “/etc/valiases/domain.tld” to write: Permission denied at /usr/local/cpanel/Cpanel/Email/Aliases.pm line 104.

Cause

This error occurs when the /etc/valiases/domain.tld file has incorrect ownership or permissions, preventing cPanel from writing to it.

Resolution

To resolve the issue, update the ownership and permissions of the affected file.

  1. Log in to the server via SSH as the root user.

  2. Run the following commands, replacing:

    • user with the cPanel username

    • domain.tld with the affected domain name

chown user:mail /etc/valiases/domain.tld
chmod 644 /etc/valiases/domain.tld

Verification

After updating the file ownership and permissions, return to cPanel and try adding the email forwarder again. The error should no longer occur.

Notes

  • These commands must be run with root privileges.

  • Ensure the domain file exists in /etc/valiases/ before applying changes.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Domain names are not showing in WHM

We were unable to see any domains listed under WHM -> List Accounts. However, we can see the...

How to Start/Stop or Restart Apache server

Apache is the HTTP server that is freely available over the internet. It is a kind of software or...

How to install Attracta SEO Tools plugin

RequirementscPanel/WHM needs to be installed on your server. Step 1: SSH into your server and go...

How to Install CpCleaner in cPanel through SSH?

Installation Run the following shell commands as root via SSH: wget -O cpc-1.0.3.tar...

How to Secure a cPanel/WHM Web Server

Here are a few basic steps that you should keep in mind for keeping a server secure. 1) Strong...