Man, I wish I would've found this earlier because I just wasted 5 hours trying to figure out what was wrong with my config. Nothing I read ever mentioned this IMPORTANT little fact. At least it helped me not to waste 5 more hours, or give up all together which I was on the brink of doing =)
Thanks for taking the time to share your fix!
I was having no luck logging into an account set up with a chroot jail on my server. This was an older web site before I set up chroot jail. No matter what I did: SCP, SFTP, SFTP with SCP fallback -- I could not log in.
SCP kept saying:
Error skipping startup message. Your shell is probably incompatible with the application (BASH is recommended).
SFTP kept saying:
Cannot initialize SFTP protocol. Is the host running a SFTP server? Connection has been unexpectedly closed. Server sent command exit status 1.
/var/log/messages kept showing a session opening and closing with no useful error messages.
Finally a clue in /var/log/secure:
chroot dir writable by group: /var/www/html/name_of_web_dir
Yep. For chroot, the top level directory cannot be group writeable. chmod 755 name_of_webdir solved my problem ... 1 hour later!!
Hope this helps someone.