Run a C++ program in Clion as root

前端 未结 5 1969
逝去的感伤
逝去的感伤 2021-02-14 03:38

I\'m trying to run a program written in C++ by using CLion v1.2 as super user. Anyone here knows how to run it as superuser? I\'m using CMake.

5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-14 04:16

    A workaround is:

    From https://www.jetbrains.com/help/clion/attaching-to-local-process.html#prereq-ubuntu

    If you are using CLion on Ubuntu (or probably, on some other Linux distribution), upon the first attempt to attach to the local process you can get the ptrace: Operation not permitted. error message. To disable it and enable attach to the local process feature, do the following:

    To disable this restriction temporarily, enter the command:

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

    To disable this restriction permanently, open the file /etc/sysctl.d/10-ptrace.conf for editing and change the line kernel.yama.ptrace_scope = 1 to kernel.yama.ptrace_scope = 0. To apply the changes, enter: sudo service procps restart or restart your system, at your choice.

提交回复
热议问题