Web Programming, Linux System Administation, and Entrepreneurship in Athens Georgia

SSH Error: trying to get more bytes 4 than in buffer 0

I ran across this cryptic error message in an SSH log file today:

Feb  7 03:33:21 hostname sshd[19439]: error: buffer_get_ret: trying to get more bytes 4 than in buffer 0
Feb  7 03:33:21 hostname sshd[19439]: fatal: buffer_get_int: buffer error

The problem is actually a corrupt line in a users ~/.ssh/authorized_keys file. This user had copy/pasted a new key into his authorized_keys file and it had a newline after the ssh-rsa. Strangely enough, people were still able to authenticate if their key was above the corrupted line. Users whose key was listed below the corrupt line were not able to log in.

7 Comments

  1. Gervase Markham

    Thanks! I hit this too. You are right – the error is very cryptic.

  2. Daniel

    Thanks for this.

  3. ianr

    I never in a thousand years would have figured this out by myself – thanks!

  4. paresh

    SSH2 0: trying to get more bytes than in ssh_buffer in cisco switch error ….

  5. Bladimir

    This can also happen when known_host file is corrupted..

  6. Chris

    This happened for me when there was a rouge new line character in the known_host file on the CLIENT side

  7. Michael

    This can also happen if your key file permissions are not strict enough. In Linux, this command should fix it…
    sudo chmod 600 ~/.ssh/id_rsa

Leave a Reply

Your email address will not be published. Required fields are marked *

© 2025 Brandon Checketts

Theme by Anders NorenUp ↑