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
Author by
Chapo
Updated on September 18, 2022Comments
-
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.
-
davidbaumann over 4 yearsCheck the file permissions: unix.stackexchange.com/questions/37164/…
-
Chapo over 4 yearsThks that's what I put in my answer indeed.
-
-
Kevin B Burns about 3 yearsHey, FYI, sudo chown username {config,id_rsa,id_rsa.pub,known_hosts} would have saved you a few keystrokes.