(In reply to Tom de Vries from comment #11) > [ Doesn't work for me though on openSUSE Leap 15.4, I get "usage: capsh > [args ...]", to be debugged. ] Scripting problems... This works: ... $ cat sudo-allow-ptrace.sh #!/bin/sh shell="$1" shift set -x sudo \ -E capsh \ --caps="cap_setpcap,cap_setuid,cap_setgid+ep cap_sys_ptrace+eip" \ --keep=1 \ --user="$USER" \ --addamb="cap_sys_ptrace" \ --shell=$shell -- \ "$@" $ sleep 60 & ./sudo-allow-ptrace.sh gdb -p $(pidof sleep) ... $ ...