10

Running Xubuntu 16.04.1 LTS 64-bit.

/proc/sys/kernel/yama/ptrace_scope keeps resetting to 1 if I reboot, despite me changing it to 0 manually. How can I keep ptrace_scope set to a value of 0?

Aaron Franke
  • 905
  • 3
  • 13
  • 24

2 Answers2

18

/proc values are stored in RAM so it isn't persistent. But it read its initial values from a file. You can permanently change the value of /proc/sys/kernel/yama/ptrace_scope to 0 by editing the file /etc/sysctl.d/10-ptrace.conf and change the line:

kernel.yama.ptrace_scope = 1

To

kernel.yama.ptrace_scope = 0
Dababi
  • 3,229
  • 23
  • 23
  • Is any security risk attached to setting this permanently? – Philipp Ludwig Jun 25 '18 at 18:59
  • 3
    Yes, there is some risks. You can view this post for more details [https://askubuntu.com/questions/146160/what-is-the-ptrace-scope-workaround-for-wine-programs-and-are-there-any-risks] – Dababi Jul 02 '18 at 08:41
  • Well i showns how crazy the security boys have gotten. If you run a program under your user id it already can do enough damage. – Lothar Feb 27 '21 at 18:22
5

In case the change doesn't reflect in /proc/sys/kernel/yama/ptrace_scope, try doing:

echo "0"|sudo tee /proc/sys/kernel/yama/ptrace_scope