0
votes

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

1
Maybe you can try to delete the record in the file ~/.ssh/know_hosts for your VM and then ssh the VM again.Charles Xu

1 Answers

0
votes

You can do a ssh-keygen for your host machine. Then update the public key for your debian vm to reflect that of the /.ssh/id_rsa.pub file. I recently encountered a similar issue when trying to ssh into a ubuntu vm.