persistent memory limit: After system reboot MemoryLimit reset to default.

Solution Verified - Updated -

Issue

  • Want to limit maximum memory of a user on the RHEL7 system.
  • Below command does not set MemoryLimit persistently.
# systemctl set-property user-USERID.slice MemoryLimit=1G 
  • Could we limit memory system-wide for all users ?
  • Could we limit memory group based ?
  • Below does not work:-
1- useradd test
2- Open two terminals
3- In first terminal - ssh test@
4- In second terminal - run commands
   4.1- # systemctl set-property user-USERID.slice MemoryLimit=1G
   4.2- # systemctl show user-USERID.slice|grep MemoryLimit   --- This shows expected results i.e. MemoryLimit equal to 1G.
5- After system reboot MemoryLimit reset.

Environment

  • Red Hat Enterprise Linux (RHEL) 7

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.