Tuesday, 11 November 2014

sftp connection issue SOLVED and EXPLAINED Permission denied (publickey),Couldn't read packet: Connection reset by peer

You  created new system user for sftp files transfer. You followed steps for folder and file permissions and everything looks just fine BUT... when you try to connect through sftp you get this Permission denied (publickey),Couldn't read packet: Connection reset by peer error!

# sftp user1@x.x.x.x
Permission denied (publickey).
Couldn't read packet: Connection reset by peer
You have new mail in /var/mail/root

You check again is public key you exchanged OK, is it in right place, did you correctly named authorized_keys file, is file permission for sftp folder OK, etc...
But still same error.
In case you make your sftp connection more verbose

# sftp -vvv user1@x.x.x.x
.
.
.
Permission denied (publickey).
Couldn't read packet: Connection reset by peer

 Nothing there.

SFTP Permission denied (publickey).Couldn't read packet: Connection reset by peer SOLVED!!!

So what is the problem? Problem is that when you create user, you need to make password for that user on server!

On server:
x.x.x.x#passwd user1

On sftp client
#sftp user1@x.x.x.x
Connected to x.x.x.x
sftp>

As you can see, this is something that you can easily overlook and sftp will not work without this step!