I have set up public key authentication before and never had this much trouble… I am not sure what I am missing, but I have done all of the following:
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Ok… apparently it was an issue with copying the file over a remote connection.
I ran dos2unix on my id_rsa.pub, then cleared out authorized_keys and then cat id_rsa.pub >> authorized_keys…
boom, it works. Thanks to DEBUG3. (Why doesn’t verbose give key failure information…?)
I also had this same issue.
I solved it by
authorized_keys
file” into a new pub_key.txt
file locallyauthorized_keys
file via rm authorized_keys
sudo apt-get dos2unix
(I’m running Ubuntu)dos2unix pub_key.txt
authorized_keys
via cat pub_key.txt
>> authorized_keys
This finally allowed me to putty into my box as all the tutorials described.
If NOT logging in as root its also important to make sure that the ownership privileges are set properly in the home directory. Otherwise the user won’t be able to SSH into the server.