"could not open session" shows when nofile is set to unlimited in /etc/security/limits.conf

Solution Verified - Updated -

Issue

  • When the nofile is set to unlimited in /etc/security/limits.conf file the user cannot login:

    user  soft nofile 1024
    user  hard nofile unlimited
    
    # su - user
    could not open session
    
  • The messages in /var/log/secure:

login: pam_unix(remote:session): session opened for user root by (uid=0)
login: Permission denied
login: pam_limits(remote:session): Could not set limit for 'nofile': Operation not permitted

su: pam_limits(su:session): Could not set limit for 'nofile': Operation not permitted
su: pam_unix(su:session): session opened for user root by test(uid=501)

pam: gdm-password: pam_limits(gdm-password:session): Could not set limit for 'nofile': Operation not permitted
pam: gdm-password: pam_unix(gdm-password:session): session opened for user root by (uid=0)

Environment

  • Red Hat Enterprise Linux 4
  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 7

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In