What can be the reason why SSH connection is not possible when using Azure cloud shell to the VM that can be SSH connected from the command line of the local PC?

あまね 0 Reputation points
2023-06-15T15:14:58.1666667+00:00

the access point is Azure VM "A".

There are two connection sources, one (local PC command line) can be SSH connected. The other (Azure cloud shell) gives an error.
Error is "Permission denied (publickey)."

VM"A" has "authorized_keys" in "/.ssh" .
chmod is 744 this file.

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,014 questions
{count} votes

1 answer

Sort by: Most helpful
  1. deherman-MSFT 38,021 Reputation points Microsoft Employee Moderator
    2023-06-15T19:04:55.19+00:00

    @あまね

    I tested this out and I was able to SSH from Azure Cloud Shell bash environment to my Ubuntu VM using the pem file. Your permissions of 744 are too permissive on the .pem file, change to 700 and it should work.

    Please try and let me know the results.


    If you still have questions, please let us know in the "comments" and we would be happy to help you. Comment is the fastest way of notifying the experts.

    If the answer has been helpful, we appreciate hearing from you and would love to help others who may have the same question. Accepting answers helps increase visibility of this question for other members of the Microsoft Q&A community.

    Thank you for helping to improve Microsoft Q&A!

    User's image


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.