Monday, January 2, 2012

ptrace: Operation not permitted

I got above error when try to use Eclipse CDT to attach an running process for debugging.

It because of the ptrace protection since Ubuntu 10.10.

Here is the link to more detail explain
https://wiki.ubuntu.com/SecurityTeam/Roadmap/KernelHardening#ptrace%20Protection

To work around:
first need to enable root account
>sudo passwd root
>su
>echo 0 > /proc/sys/kernel/yama/ptrace_scope
>exit
re-disable root account for security reason
>sudo passwd -dl root

Now, it works

To permanently allow it edit /etc/sysctl.d/10-ptrace.conf and change the line to:
kernel.yama.ptrace_scope = 0

No comments: