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.
-
Log in to the server via SSH as the root user.
-
Run the following commands, replacing:
-
userwith the cPanel username -
domain.tldwith 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.
