I'm trying to set up resource limits per user in Centos 7, but I can't find the right commands for the new implementation of cgroups (I did read the documentation but it talks about restricting services not users).

This are the steps in Centos 6

  1. Add to /etc/cgconfig.conf

    group mygroup{ cpu { cpu.shares = 200; } memory { memory.limit_in_bytes = 128m; } }

  2. Restart service cgconfig restart

  3. Start in system boot: chkconfig cgconfig on
  4. Verify groups added correctly: lscgroup
  5. Add the processes for which we wish to limit resources to the cgroups we created: add to /etc/cgrules.conf

    myuser cpu,memory mygroup/

  6. start the cgred service for the cgrules configuration changes to take effect: service cgred start

  7. make sure the cgred service is enabled to start on system boot so that our rules persist across reboots: chkconfig cgred on

What is the equivalent in Centos 7?


1 Answer 1


I got a solution in ServerFault

systemctl set-property user-1000.slice CPUShares=100

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.