• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to set ulimit values for a systemd service

by admin

This post explains how to change the ulimit limits such as the maximum open files for a systemd service. In a CentOS/RHEL 7 or 8 system, the changes done in /etc/security/limits.conf or /etc/security/limits.d/ have no effect on systemd services.

Systemd deliberately ignores the system-wide ulimit settings in order to minimize unintentional or unexpected limit changes caused by shell profiles and scripts.

You can set a new maximum open files limit for a particular service, for example, like this:

1. Identify the name.service file you want in /usr/lib/systemd/system.

2. Copy that file to the /etc/systemd/system directory.

3. Edit the copied file in /etc/systemd/system and add the line:

LimitNOFILE=2048

4. Restart the service:

# systemctl restart [service name]

Update the ulimit values globally for all systemd services

Alternatively, you can update the same limit for ALL systemd services like this:
1. Edit /etc/systemd/system.conf and uncomment the “#DefaultLimitNOFILE=” line, appending the desired number.

2. Reboot the system:

# systemctl reboot

Filed Under: CentOS/RHEL, CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. dconf : command not found
  2. tvservice: command not found
  3. CentOS / RHEL 5 : How to rebuild Initial Ramdisk Image
  4. i3status Command Examples in Linux
  5. What is chroot jail in Linux
  6. How To Check Swap Usage of Each Processes in Linux
  7. iwctl: command not found
  8. ebuild Command Examples in Linux
  9. CentOS / RHEL 7 : How to create an Network Bonding (NIC teaming) using nmcli
  10. mpstat: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • netselect-apt Command Examples in Linux
  • netselect-apt: command not found
  • nethogs Command Examples in Linux
  • nethogs: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright