{"id":3679,"date":"2019-02-27T22:07:35","date_gmt":"2019-02-27T16:37:35","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=3679"},"modified":"2026-10-10T17:44:02","modified_gmt":"2026-10-10T12:14:02","slug":"maximum-password-attempts-centos-7","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/maximum-password-attempts-centos-7\/","title":{"rendered":"How to Set Maximum Password Attempts in CentOS 7"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Post Date: February 27, 2019<br>Last Updated: October 09, 2026<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Configuring the <strong>maximum password attempts in CentOS 7<\/strong> is an important step toward improving Linux server security. The Pluggable Authentication Modules (PAM) framework provides options for managing password policies and password-entry retries. In this tutorial, you will learn how to configure the password retry limit in CentOS 7 by reviewing the <code>pam_pwquality.so<\/code> setting in the <code>\/etc\/pam.d\/system-auth<\/code> file.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before proceeding, ensure that you have the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A server running CentOS 7.<\/li>\n\n\n\n<li>Root access or a user account with sudo privileges.<\/li>\n\n\n\n<li>Basic knowledge of Linux commands and text editors such as Nano or Vim.<\/li>\n\n\n\n<li>Access to the <code>\/etc\/pam.d\/system-auth<\/code> configuration file.<\/li>\n\n\n\n<li>A backup of the existing PAM configuration files before making any changes.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Steps to Set Maximum Password Attempts in CentOS 7<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 1 :<\/strong><br>In the \/etc\/pam.d directory, You will find the system-auth file .<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># cd \/etc\/pam.d<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code># ls -la<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image\"><img fetchpriority=\"high\" decoding=\"async\" width=\"603\" height=\"418\" data-id=\"3684\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/02\/File-List-1.png\" alt=\"\" class=\"wp-image-3684\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/02\/File-List-1.png 603w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/02\/File-List-1-300x208.png 300w\" sizes=\"(max-width: 603px) 100vw, 603px\" \/><\/figure>\n<\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 2:<br><br><\/strong>Open <strong>system-auth <\/strong>file using nano editor. On opening with nano editor, you can see the complete file as shown below. Edit statement <strong>pam_pwquality.so<\/strong>. You can change&nbsp;<strong>retry=3<\/strong>&nbsp;or make it even lower.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In CentOS, this can be easily set by editing the&nbsp;<strong>pam_pwquality.so<\/strong>&nbsp;statement present in&nbsp;<strong>\/etc\/pam.d\/system-auth<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># nano \/etc\/pam.d\/system-auth<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"772\" height=\"279\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/02\/file-.png\" alt=\"\" class=\"wp-image-3685\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/02\/file-.png 772w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/02\/file--300x108.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/02\/file--768x278.png 768w\" sizes=\"(max-width: 772px) 100vw, 772px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 3:<\/strong><br><br>Save the file.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thus, we have successfully finished configuring the <strong>max password login attempts per session for your CentOS 7 server<\/strong>. If you need any assistance Please reach out to here. <a href=\"https:\/\/pheonixsolutions.com\/contact\">Link<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Configuring the <strong>maximum password attempts in CentOS 7<\/strong> helps administrators manage password-entry retries and strengthen password policies. By reviewing the <code>pam_pwquality.so<\/code> setting in the PAM configuration file, you can adjust the number of retries allowed when setting or changing a password. Always back up the configuration files before making changes and verify the settings carefully to avoid authentication issues.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> The <code>pam_pwquality.so<\/code> module does not directly limit failed SSH login attempts. For SSH brute-force protection, use an appropriate authentication lockout mechanism or a tool such as Fail2ban. For more information about Linux authentication modules and password policies, refer to the official Documentation <a href=\"https:\/\/www.chiark.greenend.org.uk\/doc\/libpam-doc\/html\/Linux-PAM_SAG.html\" target=\"_blank\" rel=\"noopener\">The Linux-PAM System Administrators&#8217; Guide<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">FAQs<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. How do I set the maximum password attempts in CentOS 7?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">You can configure password-entry retries in CentOS 7 by reviewing the PAM configuration in <code>\/etc\/pam.d\/system-auth<\/code>. The <code>retry<\/code> parameter in <code>pam_pwquality.so<\/code> controls the number of attempts allowed when entering a new password.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. What does <code>retry=3<\/code> mean in CentOS 7?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>retry=3<\/code> parameter allows up to three password-entry attempts when setting or changing a password through the relevant PAM module. It does not directly limit failed SSH login attempts.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. What is PAM in CentOS 7?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">PAM (Pluggable Authentication Modules) is a framework that allows Linux administrators to configure authentication and password policies for system services.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Related Articles<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/how-to-install-mysql-8-0-on-centos-7\/\">How to install MySQL 8.0 on CentOS 7<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/how-to-install-openvz-7-on-centos-7\/\">How to Install OpenVZ 7 on CentOS 7<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Need Help with Linux Server Security?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Need help with Linux server security, password policies, PAM configuration, or SSH login protection? Our experts can help with Linux server administration, security hardening, server monitoring, DevOps and cloud solutions, and other infrastructure requirements. Get in touch with our team <a href=\"https:\/\/pheonixsolutions.com\/contact\">here<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Post Date: February 27, 2019Last Updated: October 09, 2026 Introduction Configuring the maximum password attempts in CentOS 7 is an [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1022],"tags":[565,307,260],"class_list":["post-3679","post","type-post","status-publish","format-standard","hentry","category-web-architecture","tag-max-password","tag-security","tag-server-hardening","psol-cat-web-architecture"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-Xl","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/3679","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=3679"}],"version-history":[{"count":3,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/3679\/revisions"}],"predecessor-version":[{"id":12227,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/3679\/revisions\/12227"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=3679"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=3679"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=3679"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}