Looks like you answered your own question -- you have ptrace_scope set to 1, so you can only trace direct children. To allow tracing any process belonging to the same user, set it to 0. This is also required to use the gdb attach
command.
READ the /etc/sysctl.d/10-ptrace.conf file as your error message suggested...