Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to lock memory from unprivileged user?

I need to lock pages of my program in memory. Program run under Solaris 10 OS from unprivileged user. I've tried to use: mlock(), mlockall() and plock(), but always get the same result:

plock/mlock/mlockall: Not owner

But it works from root. So can I lock pages of my program in memory from unprivileged user, somehow?

Thanks!

like image 283
van Avatar asked Nov 09 '11 08:11

van


1 Answers

I found decision and want to share it. May be it will be helpful for someone else. I modified privileges of user, under Solaris it can be done by next command:

usermod -K defaultpriv=basic,proc_lock_memory user

I think in Linux could be the same situation and it can be resolved using Linux capabilities.

like image 56
van Avatar answered Oct 19 '22 18:10

van