0

I'm trying to set default niceness/priority for a user's processes on Ubuntu 18.04.3 LTS in limits.conf and everything I write in limits.conf is simply ignored. Hard nice, soft nice, hard priority, soft priority, - priority, doesn't matter it just don't work.

session required pam_limits.so in /etc/pam.d/su was uncommented by default and I also tried to reboot the system after making changes in limits.conf.

Why is this happening and how do I fix it?

Example 1:

root             soft    nice            -16
root             hard    nice            -17

When I log into a server with ssh root@host.name I expect to see in top -o -NI output at least one process (my bash login session) with a NI of -16 or -17. None of the processes had this value of nice.

Example 2:

user123          soft    nice            5
user123          hard    nice            5

When I request a "http://host.name/benchmark.php" I expect to see in top -o %CPU output the PHP FastCGI process with niceness of 5. I see a PHP FastCGI process with niceness of 0

Example 3:

user123          soft    priority        25
user123          hard    priority        25

When I request a "http://host.name/benchmark.php" I expect to see in top -o %CPU output the PHP FastCGI process with priority of 25. I see a PHP FastCGI process with priority of 20

Example 4:

user123          -       priority        25

When I request a "http://host.name/benchmark.php" I expect to see in top -o %CPU output the PHP FastCGI process with priority of 25. I see a PHP FastCGI process with priority of 20

  • 1
    Give us an example line from limits.conf and what exactly should work and doesn't. – schaiba Oct 23 '19 at 7:14
  • Thank you. I've updated a question with an examples of what I have tried to set in limits.conf. – user619271 Oct 23 '19 at 7:31
1

Example 1. The documentation for nice(2) explains that "The range of the nice value is +19 (low priority) to -20 (high priority)". When you set the entry in limits.conf to -16/-17 that's effectively an upper limit that can be reduced to the values I assume you saw.

Examples 2, 3, 4. Your webserver is probably not calling PAM to change userid, so limits.conf isn't referenced.

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.