LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 05-27-2021, 01:42 PM   #1
fortea
LQ Newbie
 
Registered: Aug 2011
Posts: 13

Rep: Reputation: Disabled
Higher priority for root processes


Hello,
I need to set a higher priority for sshd and sshguard processes, but I can’t find a way. On my server, there are 2 types of users (faculty and student with corresponding groups) plus the root. Moreover, I need a realtime group.

Users from group faculty (also student, if needed) need to be able to ssh even if the server RAM is almost full.

Here is my limits.conf:

Code:
root            soft    priority        -15
@faculty        soft    priority        -5
@student        soft    priority        0
@realtime       soft    priority        -10

root            hard    nice            -20
@faculty        hard    nice            -10
@student        hard    nice            -5
@realtime       hard    nice            -15

@faculty        hard    nofile          16384
@faculty        soft    nofile          16384
@realtime       soft    rtprio          99
@realtime       soft    memlock         500000
However, at startup processes from faculty run with default priority 10 and niceness -10, while root processes run with default priority 20 and niceness 0.

How can I make root processes run with default priority lower than other groups?
 
Old 05-27-2021, 03:25 PM   #2
igadoter
Senior Member
 
Registered: Sep 2006
Location: wroclaw, poland
Distribution: many, primary Slackware
Posts: 2,717
Blog Entries: 1

Rep: Reputation: 625Reputation: 625Reputation: 625Reputation: 625Reputation: 625Reputation: 625
Probably you need rebuild or even patch kernel to achieve support for real time processes. Higher priority for daemon process? Why do you need that? Something with ssh connection? Do you have thousands ssh connections per second?
 
Old 05-27-2021, 03:56 PM   #3
fortea
LQ Newbie
 
Registered: Aug 2011
Posts: 13

Original Poster
Rep: Reputation: Disabled
The server is mainly used for scientific experiments and it happens that some user fills the RAM, making it impossible to log in. I'm still trying to set up nohang or another oom-killer properly, but in the meanwhile, it would be useful to be able to access the server when problems occur, so that I can understand why nohang is not killing processes...

In general, I want to be able to access the server in any circumstance, because it's almost the only way to log in.

f
 
Old 05-27-2021, 04:15 PM   #4
igadoter
Senior Member
 
Registered: Sep 2006
Location: wroclaw, poland
Distribution: many, primary Slackware
Posts: 2,717
Blog Entries: 1

Rep: Reputation: 625Reputation: 625Reputation: 625Reputation: 625Reputation: 625Reputation: 625
There is quotas system - at least for storage - maybe there are quotas for memory and other resources Maybe try to ask for batch mode rather than interactive - someone can run its app - at night? But I don't see how lack of RAM may influence system response. System is using swap. Stacking - procedure calls - can dramatically slow system. This behavior is something new? Keep open connection all the time. As common user. You can always sudo or su.

Last edited by igadoter; 05-27-2021 at 04:21 PM.
 
Old 05-30-2021, 10:12 AM   #5
elgrandeperro
Member
 
Registered: Apr 2021
Posts: 415
Blog Entries: 2

Rep: Reputation: Disabled
It is ulimit and you can set per user values like # processes, memory, etc. It is sometimes set
in /etc/security/limits.conf. Go "man ulimit".

You can obviously set a high watermark to prevent a single user or process hogging memory.



Here is a tutorial:


https://www.networkworld.com/article...th-ulimit.html
 
1 members found this post helpful.
Old 05-30-2021, 10:12 AM   #6
elgrandeperro
Member
 
Registered: Apr 2021
Posts: 415
Blog Entries: 2

Rep: Reputation: Disabled
It is ulimit and you can set per user values like # processes, memory, etc. It is sometimes set
in /etc/security/limits.conf. Go "man ulimit".

You can obviously set a high watermark to prevent a single user or process hogging memory.



Here is a tutorial:


https://www.networkworld.com/article...th-ulimit.html
 
1 members found this post helpful.
Old 05-31-2021, 05:39 AM   #7
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,145

Rep: Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124
Quote:
Originally Posted by fortea View Post
The server is mainly used for scientific experiments and it happens that some user fills the RAM, making it impossible to log in.
Then fix the problem, not the symptom.
Trying to define in advance what (who) can be not killed is likely to get political. I take the opposite approach in a different environment. When I'm doing benchmarks, everything other than my terminal session runs in a single control group with the resources I define. I get the rest (not much but enough) to ensure I can monitor uninterrupted. You could do similar, and as suggested above, keep your ssh session active but disconnected so you can re-connect later when you need to investigate. Won't help anyone else but in the investigation stage that's probably what's needed.

Like I said, politics means the world is likely crash down on you if this gets out. :shrug:
 
Old 05-31-2021, 02:31 PM   #8
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,807

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by fortea View Post
The server is mainly used for scientific experiments and it happens that some user fills the RAM, making it impossible to log in.
renice(1) might be used to tweak the scheduling priority of sshd process. But this is a hammer instead of a scalpel: everyone's ssh connection is affected.

In my experience, though, this seems like more of an "insufficient swap space" or "process ulimit" problem than one about daemon scheduling priorities. Once a user has sshed into the system and grabbed all available memory, I'm not certain how having modified the priority of sshd would help. Raising the priority of the sshd process is no guarantee that someone will be able to get onto the system when the system is completely starved of available RAM.

The output of free(1) would be interesting to see.
 
1 members found this post helpful.
Old 06-03-2021, 08:56 AM   #9
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,679
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
I agree with rnturn's assessments. Fiddling with process priorities won't help you here. Your system is becoming over-committed and so it is "thrashing."

As others have noted, the ulimit command can be used to prevent user processes from commanding too much memory, but this is only partially useful if your system is thrashing. You might simply need more hardware, particularly RAM. ("Chips are cheap ... splurge.")
 
  


Reply

Tags
limits.conf, priority, ssh



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
X: warning; priority set to -1 instead of requested priority 0 HitmanX Linux - Newbie 5 12-13-2010 11:09 AM
which value is for highest priority for real-time processes icoming Linux - Software 3 12-19-2009 10:30 PM
LXer: Open Source professionals higher skills, higher paid: survey LXer Syndicated Linux News 0 03-11-2008 04:41 PM
process priority,nice -- small question regarding high/low priority values beeblequix Linux - Newbie 1 10-11-2006 10:22 AM
Priority of processes (using nice) started from within a script podollb Linux - Software 1 01-08-2006 11:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 01:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration