I was setting some limits on CentOS 5.2 with 24GB of RAM. I wanted to set a limit to virtual memory for a process of group of users to be no more than 4GB. Normally, you a user can do this for its own bash session using
ulimit -v 4000000
I wanted to do the same thing but to as a root (i.e. admin of a server) to a group of users. Such limits can normally be set in /etc/security/limits.conf. There are many limits
# - core - limits the core file size (KB)
# - data - max data size (KB)
# - fsize - maximum filesize (KB)
# - memlock - max locked-in-memory address space (KB)
# - nofile - max number of open files
# - rss - max resident set size (KB)
# - stack - max stack size (KB)
# - cpu - max CPU time (MIN)
# - nproc - max number of processes
# - as - address space limit
# - maxlogins - max number of logins for this user
# - maxsyslogins - max number of logins on the system
# - priority - the priority to run user process with
# - locks - max number of file locks the user can hold
# - sigpending - max number of pending signals
# - msgqueue - max memory used by POSIX message queues (bytes)
# - nice - max nice priority allowed to raise to
# - rtprio - max realtime priority
However, I could not find anything for virtual memory, nor I could find any info about this in the Internet. Therefore, I used the try-and-see approach. Finally, I found that item "as" (i.e. address space limit (kb)) does this! Therefore I made a limit to a group
@somegroup hard as 4000000
To check it, I logged in to a server using ssh as a user from the "somegroup" and executed
[test@w ~]$ ulimit -a | grep virtual
virtual memory (kbytes, -v) 4000000
This is of course a limit per process of a user from this group, and not limit for a user of a group!
THANKS!
ReplyDeleteBasically you saved the day. ;)
thanks,
ReplyDeleteflip
Dear sir, you are my savior.
ReplyDeleteThanks! Was looking for this as well, too bad this isn't explained in limits.conf(5)
ReplyDeleteI had this issue recently with my server and not sure why it wasn't set to unlimited.
ReplyDeleteNow everything is ok.
Hi This saved a lot of search effort
ReplyDeletea quick question
how to make this change reflect to the running processes
Благодарю! Вы - мой спаситель!
ReplyDeleteThank you 2009 from 2019!
ReplyDeleteThank you from 2021!
ReplyDelete