SSH passwordless login - debug2: we did not send a packet, disable method

When managing a lot of server it's quite convenient to set up SSH to login without asking for a password. The method consists of just 4 simepl steps.

  1. generate a public and a private key pair
    ssh-keygen -f keysfile
  2. upload the public key to the server in your home folders "~/.ssh" directory (create it if it's not there) to remotehost/~/.ssh folder
  3. dump that key to the accepted keys (in the same .ssh folder)
    cat > authorized_keys
  4. login to the server using the private key from your client
    ssh -i keysfile username@remotehost
If something goes wrong, try running SSH with debug messages:
ssh -i keysfile username@remotehost -vv

If you see the following error message:
debug2: we did not send a packet, disable method
it's most probably because the server cannot access the authorized_keys file. Some howtos just add your keyfile's name to authorized_keys but that failed for me all the time. Dumping the public key to the file solved this problem.


  1. thanks! this help me to solve my problem...

    $ sudo chmod 700 ~/.ssh
    $ sudo chmod 600 ~/.ssh/*

  2. setting permissions helped me:

    sudo chown -R `whoami` ~

  3. check your sever log file.
    one problem occurred to me is my home directory has write permission for the group.
    Removing that will solve the problem.

    1. Thankfully this kind of information gets stored online and findable by search engines ;-)

      Thanks for sharing (obviously your tips really helped me)!

  4. This comment has been removed by the author.


Post a Comment

Popular posts from this blog

MurMurHash3, an ultra fast hash algorithm for C# / .NET

ESP32 - send a push notification from the Arduino ESP32 device to your phone

Octoprint as a systemd service - running it with high priority