How to enable/disable the Ptrace block? Print

  • Ptrace, Ptrace block, Security, CSF, CloudLinux, sysctl
  • 11

Are you seeing this security message in CSF? CloudLinux Disable ptrace is not configured. You should configure it in /etc/sysctl.conf to prevent users accessing server resources that they do not need on web servers

Here's how to secure CloudLinux correctly.

Environment

CloudLinux OS


What CloudLinux Does by Default

By default, CloudLinux does not block ptrace. The kernel settings are:

 
kernel.user_ptrace = 1 kernel.user_ptrace_self = 1
  • kernel.user_ptrace determines if PTRACE_ATTACH is allowed.

  • kernel.user_ptrace_self controls PTRACE_TRACEME.


How to Disable All Ptrace Functionality

To disable ptrace completely, add the following lines to /etc/sysctl.conf:

 
## CL: Disable ptrace for users kernel.user_ptrace = 0 kernel.user_ptrace_self = 0

Then apply the changes by running:

 
sysctl -p

Important Note

Some software may require ptrace functionality. If that’s the case, consider disabling only one of the options — this gives you partial ptrace protection while allowing needed functionality to continue working.


Was this answer helpful?

« Back