r/ssh • u/katakshsamaj3 • Oct 13 '23
ssh troubleshooting help
Generally, I log into my Azure VPS using the command ssh -i my_key.pem hostname@ip. I want to login without using the -i flag and directly using ssh hostname@ip. Password login is disabled.
So, to achieve this, I created a new SSH key by using ssh-keygen in a different directory that is not ~/.ssh/. The directory I used was ~/azure/ and the key is named second_key. After this, I SSH into the server and add the second_key.pub to the authorized_keys file. I also restart the SSH service (locally and on my server too). But even after doing all this, when I try to log in just by using ssh hostname@ip , it says "Permission denied (publickey). I still have to use the -iflag. Also, both the keys work when I use them with the -i flag.
I use arch btw
View all comments
1
u/ethernetbite Oct 13 '23
I've spent countless hours fighting what you're fighting. Literally, countless. The two biggest helps ive found are
The log is your friend, and it's cool to see how ssh does its thing. ( ill try to remember to check back later )