如何获得调试postgres的权限?

时间:2010-06-04 03:31:30

标签: linux postgresql debugging gdb

我有一个系统使用C方法作为Postgres数据库中的函数。当我尝试使用我的用户帐户运行gdb时,我得到了这个: ptrace: Operation not permitted

看起来像是一个许可的东西。当我将gdb作为“postgres”用户运行时,它似乎有效。我想继续运行postgres作为“postgres”用户,当我想调试时不需要su postgres。我可以以某种方式授予我的用户帐户“ptrace”权限吗?将自己添加到“postgres”组似乎没有帮助。

编辑:我在ptrace手册页上找到了这个:

EPERM  The specified process cannot be traced.  This could  be  because
              the  parent has insufficient privileges (the required capability
              is CAP_SYS_PTRACE); non-root processes  cannot  trace  processes
              that  they  cannot  send  signals  to or those running set-user-
              ID/set-group-ID programs, for obvious  reasons.   Alternatively,
              the process may already be being traced, or be init(8) (PID 1).

那么如何向用户提供CAP_SYS_TRACE权限?

1 个答案:

答案 0 :(得分:2)

似乎CAP_SYS_TRACE由LIDS控制,可能会也可能不会安装在您的计算机上。

如果你在postgres上进行大量开发,你可能更喜欢在自己的帐户下运行postgres实例 - 这就是我对我工作的许多服务器所做的事情。

相关问题