Skip to content

TechDirectArchive

Hands-on IT, Cloud, Security & DevOps Insights

  • Home
  • About
  • Advertise With US
  • Reviews
  • Contact
  • Toggle search form
Home » Linux » How to configure user resource limits and restrictions in Linux

How to configure user resource limits and restrictions in Linux

Posted on 15/11/202115/08/2023 Raphael Gab-Momoh By Raphael Gab-Momoh 4 Comments on How to configure user resource limits and restrictions in Linux
etcconf

Before discussing this, I would briefly like to touch on PAM (Pluggable Authentication Module) in Linux. PAM helps us to authenticate. Meanwhile, authentication is used by programs that provide users access to a system to be able to determine their identities. In Linux, especially centos and RedHat, many programs undergo configuration to make authentication possible from a central spot. Discover how to configure user resource limits and restrictions in Linux.

You can find other guides in these links: Practical use of SELinux in production: How to locate directory file context and restore it, how-to-create-a-static-pod-in-kubernetes-with-demos-that-can-help-you-become-a-better-kubernetes-administrator,how-to-create-and-deliver-a-report-on-system-utilization-on-a-linux-based-os/ and how-to-use-container-insights-to-get-the-full-benefits-of-azure-monitor-for-azure-kubernetes-workload/

User resource limits determine the amount of resources that can be used in  a particular user session. 

Steps in Configuring User Resource Limits

As the subject bothers on authentication and access, you should already have realized that we are being pointed to security. To configure access and limits for a user or groups of users, we should look at the configuration file in /etc/security.

How to configure  user resource limits -conf

Setting User Resource Limits

On the command line, we changed from where we were into /etc/security, and we then listed all the content in that directory as shown above. The particular file that we want to work on is limits. conf. So the next thing to do is to use a text editor like vim or nano to go into the configuration file limits. conf and make any changes that we want.

How to configure  user resource limits -limits.conf_
limits.conf

The configuration file on its own holds much valuable information that can guide us through setting user resource limits. The format it follows is <domain> <type> <item> <value>

A domain can be a user or group. Let us assume that we have a group called @techdirectarchive and a user called @raphael (it is always a good practice to put a @in front of a domain element). The type can either be a hard or a soft limit, item can be the size of the core, or the size of nproc. The value is usually the restriction that you want to set. If, for example, you want a particular group called coders to have only 30 processes running, the value will be 30.

Hard limit means that the limit will be enforced.
A soft limit is the type of limit that is not enforced immediately and sends a warning to the user before continuing the following line of action.

How to configure  user resource limits -configurationx1

In the screenshot above @students means for members of the group students. In addition, there is a hard limit that sets the number of processes to 20. Please see how to resolve Account restrictions are preventing this user from signing in: User Account Password has expired.

Demo

Assuming the @techdirectarchive team is using a server running low on resources. So that every memteam members a fair chance to use the server, we will be limiting the available resource. We will give configure @techdirectarchive group so that they can only start 25 processes . However, a user @christian will have privileged access so that he can start an unlimited number of methods. So guys, let’s head over to the console. Type the command shown in earlier steps and add it to the configuration file just shown in the screenshot below. The steps are below. With these steps, you can set user resource limits in Linux without hassle.

# cd /etc/security
#ls
# vim limits.conf
configuredxx1

We just need to enter the insert mood if we are using vi editor. Then configure the file so that the group and user can have the type, item, and values as shown above

The default number of processes that a root privileged user can have is 4026

Summary

In conclusion, we can configure /etc/security‘s limit.conf with the specific domain, type, item, and value to reflect the desired requirement using a text editor. Overall, you’ve learned how to configure user resource limits in Linux.

Rate this post

Thank you for reading this post. Kindly share it with others.

  • Share on X (Opens in new window) X
  • Share on Reddit (Opens in new window) Reddit
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on Facebook (Opens in new window) Facebook
  • Share on Pinterest (Opens in new window) Pinterest
  • Share on Tumblr (Opens in new window) Tumblr
  • Share on Telegram (Opens in new window) Telegram
  • Share on WhatsApp (Opens in new window) WhatsApp
  • Share on Mastodon (Opens in new window) Mastodon
  • Share on Bluesky (Opens in new window) Bluesky
  • Share on Threads (Opens in new window) Threads
  • Share on Nextdoor (Opens in new window) Nextdoor
Linux Tags:Linux distro

Post navigation

Previous Post: Block Upgrade to Windows 11 via Group Policy or Registry
Next Post: How to install LXC/LXD for container management

Related Posts

  • SUBVERSION FEATURE
    How to Install Apache Subversion on a Linux System Linux
  • goland
    How to install Golang on a Linux System Linux
  • LAMP
    How to setup and configure a Lamp stack on CentOS Linux
  • openstack ola
    Openstack Deployment with Devstack Linux
  • fimage2
    How to install and configure JIRA on Linux Linux
  • screenshot 2020 04 23 at 00.30.09
    How to mount a USB Drive in Linux Linux

More Related Articles

SUBVERSION FEATURE How to Install Apache Subversion on a Linux System Linux
goland How to install Golang on a Linux System Linux
LAMP How to setup and configure a Lamp stack on CentOS Linux
openstack ola Openstack Deployment with Devstack Linux
fimage2 How to install and configure JIRA on Linux Linux
screenshot 2020 04 23 at 00.30.09 How to mount a USB Drive in Linux Linux

Comments (4) on “How to configure user resource limits and restrictions in Linux”

  1. Raph Raphael Gab-Momoh says:
    15/11/2021 at 8:04 PM

    Well, it’s possible but as we all know, the more resources you have on a system the better it is for you as a user. We can use the command ulimit – S to increase resources on a soft limit. S Indicate that the resource’s soft limit has been set. A soft limit can be raised up to the hard limit’s value. If you don’t add the -S or -H flag the system will take it that you applied the increase to both Hard and Soft limit, So it’s good to specify. For hard limits, only a user with admin privileges will be able to change resource limits.

    Log in to Reply
  2. Avatar photo Uzodimma says:
    15/11/2021 at 10:37 PM

    Thank you Raphael for this piece, I did not know system resources could be managed until now.

    How do I save the new configuration after modifying the limits?

    Log in to Reply
    1. Raph Raphael Gab-Momoh says:
      15/11/2021 at 10:50 PM

      Hi Uzodinmma, thank you for reading, the particular config file in this article is limits. conf, it is a read-only vim file and there are about 5 commands that you can use to save a read-only vim file. The one I use is this, you hit ESCAPE on your keyboard then: w ! sudo tee % it will still be in read mode. The next thing to do is to hit ESCAPE:q! and u will be returned to the terminal

      Log in to Reply
      1. Avatar photo Uzodimma says:
        15/11/2021 at 11:07 PM

        Thank you for response. It is much helpful.

        Just as most config file, only root has the right to modify it, right?

Leave a Reply Cancel reply

You must be logged in to post a comment.

Microsoft MVP

VEEAMLEGEND

vexpert-badge-stars-5

Virtual Background

GoogleNews

Categories

veeaam100

Veeam Vanguard

  • schedulepythontasksinWindows
    Run Python Script via Windows Task Scheduler Windows
  • ACE magic
    How to install Windows Server unto ACEMAGICIAN Mini PC Windows Server
  • Turn bluetooth on and off
    Unable to Turn Bluetooth On or Off on Mac Mac
  • How to upgrade Trellix ePolicy Orchestrator
    How to upgrade Trellix ePolicy Orchestrator Security | Vulnerability Scans and Assessment
  • Remove Custom Domain from Entra ID and Azure tenant
    Delete Azure Tenant: Remove Custom Domain from Entra ID AWS/Azure/OpenShift
  • images
    How to perform vulnerability scan on Microsoft SQL Server Security | Vulnerability Scans and Assessment
  • wingettool
    Install Applications with Winget CLI on Windows Windows Server
  • TeamPass Password manager
    Install and configure TeamPass Password Manager Password Manager

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,813 other subscribers
  • RSS - Posts
  • RSS - Comments
  • About
  • Authors
  • Write for us
  • Advertise with us
  • General Terms and Conditions
  • Privacy policy
  • Feedly
  • Telegram
  • Youtube
  • Facebook
  • Instagram
  • LinkedIn
  • Tumblr
  • Pinterest
  • Twitter
  • mastodon

Tags

Active Directory Azure Bitlocker Microsoft Windows PowerShell WDS Windows 10 Windows 11 Windows Deployment Services Windows Server 2016

Copyright © 2025 TechDirectArchive

 

Loading Comments...
 

You must be logged in to post a comment.