SecureLinks Setup: Stop Symbolic Link Attacks in cPanel
SecureLinks blocks unsafe symlink use across cPanel accounts, protecting user data on CloudLinux VPS with kernel‑level checks and easy WHM setup.
5 min read
Running multiple cPanel accounts on one server gives hosting providers flexibility, but it also creates a shared‑filesystem environment. In this setting, a user can unintentionally—or maliciously—affect another account by creating symbolic links (symlinks) that point to files or directories owned by a different cPanel user. If unchecked, a symlink can be used to read or overwrite another user’s data, leading to data leakage or privilege escalation.
CloudLinux SecureLinks is a kernel‑level feature that blocks unsafe symlink usage across cPanel accounts. It works by checking the ownership of the target file and the user who created the link, denying the operation when they differ. This article walks you through enabling and configuring SecureLinks on a CloudLinux server that runs cPanel/WHM, ensuring each account stays isolated from the others.
Prerequisites and Understanding SecureLinks
CloudLinux 8.x or newer installed on a supported RHEL‑compatible distribution (AlmaLinux, Rocky Linux, or CentOS Stream).
Root access to the server via SSH.
cPanel & WHM 108 or later (SecureLinks integration is built‑in).
SecureLinks operates at the kernel level, so it does not rely on individual PHP or Apache settings. When a user attempts to follow a symlink, the kernel checks the UID of the process and the UID of the target file. If the two UIDs differ, the kernel returns EPERM and the request fails. This prevents a cPanel user from accessing another user’s files through a crafted symlink.
Verifying Kernel Support and Installing the SecureLinks Package
SecureLinks is delivered as part of the cloudlinux-sysctl package. Ensure the kernel supports the required sysctl parameters.
The dnf command installs the package, and sysctl -a confirms the default values. If the parameters are missing, the package installation may have failed or you are running an unsupported kernel.
Enabling SecureLinks System‑Wide
By default, CloudLinux ships with SecureLinks disabled to avoid breaking legacy scripts. You can enable it globally with a single sysctl command, and then make the change persistent.
Step‑by‑step (AlmaLinux / Rocky Linux / CentOS Stream)
The sysctl --system command reads every file in /etc/sysctl.d/ and applies the values immediately.
Configuring cPanel to Respect SecureLinks
cPanel’s internal file manager and PHP handlers need to be aware that symlink checks are in place. CloudLinux provides a WHM plugin that automatically adjusts the necessary configuration files.
The first command should return a line count equal to the number of accounts, confirming the flag exists for each. The second command shows the actual flag line (e.g., securelinks=1).
Testing the Protection
Before relying on SecureLinks in production, perform a controlled test with two dummy cPanel accounts: user1 and user2.
Switch to user2 and attempt to create a symlink pointing to user1’s file:
# su - user2
$ ln -s /home/user1/secret.txt ~/link.txt
ln: failed to create symbolic link ‘/home/user2/link.txt’: Permission denied
The Permission denied error demonstrates that SecureLinks blocked the operation. If the link is created successfully, double‑check that the sysctl values are set to 1 and that the cPanel plugin has been applied.
Managing Exceptions and Compatibility
Some legacy applications may rely on cross‑account symlinks (e.g., shared libraries in a custom setup). CloudLinux allows you to create a whitelist of directories that are exempt from SecureLinks checks.
This tells the kernel to skip ownership checks for symlinks whose target resides under /opt/shared. After adding entries, reload the sysctl configuration:
# sysctl --system
Use whitelisting sparingly and document each entry, as it reduces the isolation guarantee that SecureLinks provides.
Conclusion
Enabling CloudLinux SecureLinks adds a robust, kernel‑level barrier against symbolic link attacks across cPanel accounts. By installing the cloudlinux-sysctl package, setting the appropriate sysctl values, and using the CloudLinux cPanel plugin, you can protect each user’s data without altering application code. Always test the configuration on non‑production accounts, and keep any whitelist entries to a minimum. With SecureLinks in place, your shared hosting environment gains an extra layer of security that aligns with CloudLinux’s core mission: keeping multiple users safely isolated on a single server.