SSH error on Linux : Failed to add the host to the list of known hosts

10,917

All files should be owned by the user trying to connect.

So in my case I had to use an admin user to do

sudo chown my_user config
sudo chown my_user id_rsa
sudo chown my_user id_rsa.pub
sudo chown my_user known_hosts
Share:
10,917
Chapo
Author by

Chapo

Updated on September 18, 2022

Comments

  • Chapo
    Chapo over 1 year

    I am getting this error

    Failed to add the host to the list of known hosts (/home/my_user/.ssh/known_hosts).

    my_user@the_server.com: Permission denied (publickey).

    I struggle to figure out why I am getting it.

  • Kevin B Burns
    Kevin B Burns about 3 years
    Hey, FYI, sudo chown username {config,id_rsa,id_rsa.pub,known_hosts} would have saved you a few keystrokes.