How to execute a process with CAP_SYS_RESOURCE
Asked Answered
K

3

11

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?

Karolekarolina answered 18/9, 2010 at 0:43 Comment(0)
O
7

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.

Oligopoly answered 13/3, 2013 at 15:52 Comment(0)
A
3

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

Amando answered 5/8, 2011 at 9:24 Comment(0)
Z
1

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

:)

Zoon answered 18/9, 2010 at 1:11 Comment(1)
I set with RLIM_INFINITY and still got "message too long" =/Karolekarolina

© 2022 - 2024 — McMap. All rights reserved.