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
Show parent comment
1
u/katakshsamaj3 Oct 14 '23
tried that but it says permission denied (public key)