Here is an extract of Filezilla debug traces :
Offered public key from "(...)" Offer of public key accepted, trying to authenticate using it. Access granted Server unexpectedly closed network connection
I notice same behaviour from putty in debug mode, access is granted and then "Server unexpectedly closed network connection".
When removing following lines from /etc/ssh/sshd_config :
Match User user1 ChrootDirectory /home/user1 AllowTCPForwarding no X11Forwarding no ForceCommand /usr/lib/openssh/sftp-server
Then Filezilla can connect but not PuTTY. This is fine as I only target FTP, but then user1 can access much more than the required home directory, which is not good.
Any idea of how to troubleshoot this issue? Is there any log to look at on server side?
PS: I don't think it has anything to do with the issue, but authentication is key based (as it appears in traces).
Update: Thanks to Fred Clausen good advice, I had a look into /var/log/secure and fixed "fatal: bad ownership or modes for chroot directory component" issue. But it's still not working. Here is what's now content of /var/log/secure
Accepted publickey for user1 from ***.***.***.*** port 56432 ssh2 pam_unix(sshd:session): session opened for user user1 by (uid=0) subsystem request for sftp by user user1 pam_unix(sshd:session): session closed for user user1
From the Filzilla debug, I found this interesrting error:
Event Log: Started a shell/command Incoming packet #0xc, type 94 / 0x5e (SSH2_MSG_CHANNEL_DATA) 00000000 00 00 01 00 00 00 00 26 2f 62 69 6e 2f 62 61 73 .......&/bin/bas 00000010 68 3a 20 4e 6f 20 73 75 63 68 20 66 69 6c 65 20 h: No such file 00000020 6f 72 20 64 69 72 65 63 74 6f 72 79 0d 0a or directory..
Looking into it...