1

I am experiencing some weird problem in my SFTP server.

Some of my clients not able to connect through sftp using key authentication.

I have chrooted all the sftp users in two different directories where two authorized_keys files were maintained. One of the directory working fine and other is not.

For example: I have a two chroot directory dir1 and dir2 for different users in the same server. I have created a ssh keys and configured the public key in authorized_key of dir1 and connection were established and in other directory(dir2) when i place the keys in authorized_keys the connection breaks with the following error.

debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug3: Wrote 368 bytes for a total of 1645
Connection closed by xx.xx.xx.xx
Couldn't read packet: Connection reset by peer

I thought the authorized_key file got corrupted in dir2 but some users are connecting through the key authentication. Also i had downloaded the authorized_key file and placed in different server to test the connection and connection was successful.

Please show me some light.

server Permission for .ssh folder and authorized_keys

 drwxr-xr-x   2 root     root        12288 Sep 26 10:33 .ssh
 ]#ll .ssh     
 -rw-r--r-- 1 root root 123243 Sep 26 15:03 authorized_keys

No entry in server logs regarding the issue or connection. While login my sftp banner received to the client but public key tranfer got dropped.

Edited to clarify

When i verified authorized_keys, it shows too many invalid keys and comment keys in the file. Is this due to too many invalid keys.

  • What are the permissions on these directories and their parents? What does the server log say? Possibly related/duplicate – Jakuje Sep 26 '16 at 19:01
  • I have edited my question @Jakuje – Sasee Sep 26 '16 at 19:15
  • Can you clarify? Part of your question suggests that some people can connect OK to the user associated with dir2 but other people are failing. Is that right? If so what's the difference between the clients that can connect and those that can't? – Paul Haldane Sep 26 '16 at 21:19
  • What version of Red Hat Linux is the server running? – Paul Haldane Sep 26 '16 at 21:19
0

As my dir2 authorized_keys had lot of invalid keys, so i recreated the authorized_keys by removing all invalid public keys. Now the connection issue is resolved and got a positive feedback from the clients.

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.