SSH closes connection after login Exit status 254

For the record this was certainly a problem forking the user shell. Those can be caused by:

  1. a problem in shell initialization files
  2. an out of memory condition
  3. an out of processes condition

This is a very late answer, but in this situation I would have tried executing a command directly, for example: ssh server ls -ltra which could bypass some shell initialization, logging in as another user which would use some different shell initialization files, and then by rebooting, which should fix any out-of-resources condition.


I was changed the Open files configuration in kernel parameter file /etc/security/limits.conf to unlimited and lost the connectivity.

After reverting it back to the normal for root user i got the connectivity back.

Wrong Example:
## Example hard limit for max opened files
*        hard   nofile unlimited
root     hard   nofile  unlimited
## Example soft limit for max opened files
*        soft   nofile unlimited
root     soft   nofile unlimited

Correct Ex:
## Example hard limit for max opened files
*        hard   nofile 16000
root     hard   nofile 16000
## Example soft limit for max opened files
*        soft   nofile 16000
root     soft   nofile 16000