LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 08-04-2022, 08:49 PM   #1
slac
Member
 
Registered: May 2019
Posts: 265

Rep: Reputation: Disabled
Question How to manage limits.conf?


I need to apply the following configuration:

Code:
username hard nofile 524288
... To the file /etc/security/limits.conf in order to make Esync work but I do not know how.

How am I supposed to manage limits on LFS? Is /etc/limits related to such operations? If so, then how I do translate what is supposed to go into limits.conf to what it should go into /etc/limits, because as far as I see those probably are in different format.

Edit: By the way, I am not using PAM. That is why I am asking how to apply the configuration that is the code tags to /etc/limits instead of /etc/security/limits.conf

Last edited by slac; 08-04-2022 at 08:51 PM. Reason: Edit: Not using pam by the way.
 
Old 08-12-2022, 06:56 PM   #2
JP3
LQ Newbie
 
Registered: Aug 2022
Posts: 13

Rep: Reputation: 0
Quote:
Originally Posted by slac View Post
I need to apply the following configuration:

Code:
username hard nofile 524288
... To the file /etc/security/limits.conf in order to make Esync work but I do not know how.


Not clear on what the actual question is and I'm not familiar with "Esync", but the process is pretty standard.

Find out what the username is for the owner of the "Esync" service you want to adjust limits for. If there is no unique user associated with that service, look for a unique user-group name. If there is no unique name for that service to distinguish it from other users/groups, then you're best bet is to create a unique group and then set that group as the group for the "Esync" service.

The format for the file is:
Code:
[domain] [type] [item] [value]
[domain] is the unique username and or user-group name for the "Esync" service from above.

[type] is the type on limit enforcing, "hard" limits, or "soft" limits

[item] is what is being limited. In your case, you probably want to specify:
core – limits the core file size (KB)
data – max data size (KB)
fsize – maximum filesize (KB)
nofile – max number of open files
nproc – max number of processes
and maybe others (https://linux.die.net/man/5/limits.conf)

[value] is the actual value that the [item] will be limited to




Quote:
Originally Posted by slac View Post
How am I supposed to manage limits on LFS? Is /etc/limits related to such operations? If so, then how I do translate what is supposed to go into limits.conf to what it should go into /etc/limits, because as far as I see those probably are in different format.

Edit: By the way, I am not using PAM. That is why I am asking how to apply the configuration that is the code tags to /etc/limits instead of /etc/security/limits.conf

As far as I'm aware, there's no such "/etc/limits" file. You'll be dealing specifically with "/etc/security/limits.conf".

Since you mention that you're NOT using PAM for auth, then you need to preface your domain with the "@" symbol to search for a match with any defined users/groups in any group database back-end (PAM, LDAP, NIS, etc...)


Without knowing what the unique name is for [domain], or any of the [item](s) that you want/need to adjust, I can't give you a working example to try. https://linux.die.net/man/5/limits.conf has an example that you can use, and edit as needed.

non-working example:

Code:
@esync-username               soft       nofile           1024
@esync-username               soft       fsize            819200
@esync-username               hard       nproc            20

Last edited by JP3; 08-12-2022 at 06:57 PM. Reason: restructured for easier reading
 
Old 08-14-2022, 05:38 PM   #3
slac
Member
 
Registered: May 2019
Posts: 265

Original Poster
Rep: Reputation: Disabled
Question

Quote:
Originally Posted by JP3 View Post
Not clear on what the actual question is and I'm not familiar with "Esync", but the process is pretty standard.

As far as I'm aware, there's no such "/etc/limits" file. You'll be dealing specifically with "/etc/security/limits.conf".

Since you mention that you're NOT using PAM for auth, then you need to preface your domain with the "@" symbol to search for a match with any defined users/groups in any group database back-end (PAM, LDAP, NIS, etc...)
The file /etc/security/limits.conf seems to be used along with PAM, at least from the BLFS book this is what is said:

Code:
Instead of using the /etc/limits file for limiting usage of system resources, Linux-PAM uses the pam_limits.so module along with the /etc/security/limits.conf file. Rename the /etc/limits file using the following command:

[ -f /etc/limits ] && mv -v /etc/limits{,.NOUSE}
Since I have not configured PAM yet, I wanted to know how to apply the configuration that supposedly goes into security/limits.conf but for the file /etc/limits. The configuration would be the following:

Code:
# /etc/security/limits.conf
someuser hard nofile 524288
The file /etc/limits seems to use a different configuration syntax from security/limits.conf and that is what I am asking: How to translate from limits.conf to /etc/limits the same configuration.
 
Old 10-30-2022, 10:00 AM   #4
slac
Member
 
Registered: May 2019
Posts: 265

Original Poster
Rep: Reputation: Disabled
If PAM is not used in a system, then the shadow package has something to do with the management of such configurations. In order to apply the configurations that I wanted to but using shadow the following can be done:

Code:
# /etc/limits
someuser N524288
The /etc/limits is used instead of /etc/security/limits.conf and 'N' stands for max number of open files. The only thing missing is probably the "hard" config from /etc/security/limits.conf, but it still, at least for my case, works correctly.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
soft and hard limits for nproc value in /etc/security/limits.conf file kraljic Linux - General 3 07-13-2015 08:13 AM
Soft limits and hard limits of process gaurav_s Linux - Software 4 01-06-2015 09:57 AM
Setting limits in /etc/security/limits.conf vaibhav.vsk Linux - Security 1 09-20-2012 08:22 AM
limits are not working (limits.conf) PkerC Red Hat 3 06-22-2006 10:14 AM
LXer: Manage Apache Download Speed And Traffic Limits With mod_cband LXer Syndicated Linux News 0 06-04-2006 04:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 10:20 AM.

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