Enabling Symlink Protection on CloudLinux Servers

Introduction:

Symlink protections play a crucial role in preventing unauthorized access to files beyond a user's designated directories. CloudLinux servers offer various options to address such security concerns, with the most widely supported cPanel option being "SecureLinks," which comes pre-enabled.

Procedure:

To ensure effective symlink protection, confirm that the following kernel settings are enabled:

  • fs.enforce_symlinksifowner = 1
  • fs.process_symlinks_by_task = 1
  • fs.symlinkown_gid = 99

You can verify these settings using "sysctl" commands:

sysctl fs.enforce_symlinksifowner
sysctl fs.process_symlinks_by_task
sysctl fs.symlinkown_gid

To check all three settings at once, use:

sysctl -a | grep -E 'enforce_symlinksifowner|process_symlinks_by_task|symlinkown_gid'

Ensure the output matches the following:

fs.enforce_symlinksifowner = 1
fs.process_symlinks_by_task = 1
fs.symlinkown_gid = 99

If these values are not set, you can configure them by following these steps:

1. Edit the file /etc/sysctl.d/90-cloudlinux.conf using a text editor such as vi, vim, or nano.
2. If the symlink protection options are not already defined, add the following lines. If they are defined, update them to the specified values:

fs.enforce_symlinksifowner = 1
fs.process_symlinks_by_task = 1
fs.symlinkown_gid = 99

3. Reload sysctl to apply the changes:

sysctl --system

Note: CloudLinux typically defines these protections by default. If the values are already set, no additional action is required.

  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

How to fix lveinfo database error of CLN

Run the following command: service lvestats stoptar -zcvf /root/lveinfo_backup_$(date...

How to Install KernelCare on cPanel/WHM server

To install KernelCare, you need to log in with the root user on your cPanel server. Check for...

Switching all cPanel acc/s to "inherit" PHP version

You can change all cPanel users to inherit with this CLI command: for each in `cat...

How to fix issues like PHP selector not available

Some of our clients face the issues like "PHP selector not available" on cPanel accounts of their...

CloudLinux installed, but still showing CentOS

Some of our clients face the issue, that's why we're writing the tutorial to fix it. First of...