I've create azure debian vm and during the creation process the .pem file with private key was created for me. And I have downloaded it to my Mac OS machine.
I've copied the pem file to ~/.ssh/vmuser.pem
I've set the permissions of the file to chmod 400 ~/.ssh/vmuser.pem
Then I've tried to ssh into the vm using:
ssh -i ~/.ssh/vmuser.pem [email protected]
First time I did it it asked me if the fingerprint is correct, which I said yes. And I was able to ssh into the machine.
But when I droped the session and I'm retrying the command:
ssh -i ~/.ssh/vmuser.pem [email protected]
I'm getting
Permission denied (publickey).
error
~/.ssh/know_hosts
for your VM and then ssh the VM again. – Charles Xu