in my Linux machine - red-hat

I successfully to login to different users as the following

su - userC
[machine@Linux ~]$ pwd
[machine@Linux ~]$ /Users/userC

but only in one user I get the following

su - UserA
Creating directory '/User/UserA'.
could not open session

please advice from where I get the message "could not open session"

what could be the problem ?

  • what is the output of getent passwd and are you using LDAP, flat files, or something else? It really looks like UserA's shell is set to /sbin/nologin – SailorCire Dec 2 '14 at 17:50
  • Does that directory exist? Is the difference in case on /Users/userC and /Users/UserA a typo? Intentional? The problem? – Etan Reisner Dec 2 '14 at 17:51
  • yes I already tried the getent passwd and the output is fine – maihabunash Dec 2 '14 at 17:53
  • if I am using LDAP , not sure but the file /etc/openldap/ldap.conf exist in my machine so I guess yes – maihabunash Dec 2 '14 at 17:59
  • but which file or app send the mesg - could not open session? – maihabunash Dec 2 '14 at 18:03
root@hostname # su - oracle
could not open session

root@hostname # grep oracle.*nofile /etc/security/limits.conf
oracle          -       nofile          unlimited

set nofile in limits.conf to some number instead of unlimited:

root@hostname # vi /etc/security/limits.conf
root@hostname # grep oracle.*nofile /etc/security/limits.conf
oracle          -       nofile          65536
root@hostname # su - oracle
-bash-4.1$ id
uid=201(oracle) gid=5504(oinstall) groups=5504(oinstall),251(dba),5502(asmdba),5505(oper)
  • On my system, the soft OS limit is: cat /proc/sys/fs/file-max # 512000 Which suggests you need the line oracle - nofile 512000 instead – James McGuigan Mar 1 '18 at 13:58

If "nofile" is set to "unlimited" in /etc/security/limits.conf (or in files in limits.d) then the user cannot login.


This is what worked for me, in my case su was working for some users. So, I checked the content of /etc/pam.d/su and it had the following two lines :

session include system-auth

session optional pam_xauth.so

I commented out the first one, restarted the session and it worked.


Commenting out 'session include system-auth' worked for me.

env: docker oraclelinux:latest, after installing oracle-database-server-12cR2-preinstall.x86_64 package.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.