Leonardo Alt
Leonardo Alt

Reputation: 325

How to execute a process with CAP_SYS_RESOURCE

I'm using Linux POSIX mqueue implementation, and I have a problem. For current kernel, the max message size is 1MB, but I need to have no limit.

man mq_overview says that if the process is privileged (a process that has CAP_SYS_RESOURCE capability) it has no limits. I thought that a process executed by root was already privileged, but I'm still getting "message too long" error (my message has 2MB).

How can I add CAP_SYS_RESOURCE capability to the process?

Upvotes: 11

Views: 8721

Answers (3)

coltox
coltox

Reputation: 370

I don't know if it is possible to set it to a running process (I guess not) but you can grant the CAP_SYS_RESOURCE capability to an executable file using # setcap 'CAP_SYS_RESOURCE=+ep' /path/to/executable (as super user). In this example the +ep turns down into raise the CAP_SYS_RESOURCE capibility to be permitted and effective. However the man pages capabilities(7) and setcap(8) are useful sources for further information.

Upvotes: 7

Phuc Vinh
Phuc Vinh

Reputation: 31

you can change the ceiling on the maximum message size on this file /proc/sys/fs/mqueue/msgsize_max I hope it works

Upvotes: 3

user451155
user451155

Reputation:

try the option RLIMIT_MSGQUEUE in function: int setrlimit(int resource, const struct rlimit *rlim);

man page: http://www.kernel.org/doc/man-pages/online/pages/man2/setrlimit.2.html

:)

Upvotes: 1

Related Questions