Centos Docker container su: cannot open session: Permission denied

Issue: After an software update in a Centos 7 docker container `su – user` is no longer possible with the following error

bash-4.2# su - username
Last login: Wed Sep 13 13:20:31 UTC 2017
su: cannot open session: Permission denied

Cause:
Inappropriate settings of nofile in either in

/etc/security/limits.conf

or

/etc/security/limits.d/*.conf

Solution:
There are several solution, which suggest removing nofile unlimited like editing limits.conf and Redhat proposed solution.

However there are also files under /etc/security/limits.d/, where you need to fix nofile references as well. Where you need to change it from unlimited or a number like 500000 to 65536 or less.

bash-4.2# cat /etc/security/limits.d/50-open-files.conf
*         hard    nofile      500000
*         soft    nofile      500000

Need to be edited to become:

bash-4.2# cat /etc/security/limits.d/50-open-files.conf
*         hard    nofile      65536
*         soft    nofile      65536

Categories