How to connect to VM using SSH?

Alexandre Paiva 0 Reputation points
2023-02-18T00:50:01.53+00:00

I have a azure vm.

I want to connect to it using ssh.

How do I do this? I have been trying for 1 week now, I connect using username@IP and it asks for the password. I give it the password and it says 'Permission denied, please try again.'.

I tried using the PEM file, same thing.

Nowhere do I find help on this or documentation, such a simple issue but I have no idea how to fix it.

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

3 answers

Sort by: Most helpful
  1. Ali AliPour 0 Reputation points
    2023-02-18T01:15:13.88+00:00

    If your personal OS is Linux:

    You can now connect to the VM with SSH in the Azure Cloud Shell or from your local computer. Replace the example IP address with the publicIpAddress noted in the previous step.

    ssh azureuser@PublicIpAddress
    

    example :

    ssh azureuser@10.20.30.40
    

    And if your personal OS is Windows:

    https://video2.skills-academy.com/en-us/azure/virtual-machines/windows/connect-ssh?tabs=azurecli

    0 comments No comments

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  3. vipullag-MSFT 26,211 Reputation points
    2023-02-20T06:30:11.9033333+00:00

    Hello Alexandre Paiva

    Adding to above response of Ali on how to connect from Linux and Windows Machines to an Azure VM via, I would also request you to check if port 22 is open and is accessible on the Public IP of VM.

    Try to check if port 22 is open on the Public IP using this link(https://ping.eu/port-chk/). This should show open. If this results as Closed, then check the NSG impacting VM and add port 22 to open traffic on 22 port.

    Ref: https://video2.skills-academy.com/en-us/azure/virtual-network/tutorial-filter-network-traffic#create-security-rules

    User's image

    Also, if you are trying to connect from a Windows machine using putty, you have to convert your pem file to ppk first.

    Use puttygen tool to convert it https://www.puttygen.com/convert-pem-to-ppk

    Once you have the ppk file to connect to VM, open putty and key in the public IP of the Azure VM in the Hostname.

    Select the ppk file under the Auth tab and select Open. Once the SSH connection is established, then key in the username.

    User's image

    Hope this helps.

    If you need further help on this, tag me in a comment.

    If the suggested response helped you resolve your issue, please 'Accept as answer', so that it can help others in the community looking for help on similar topics.

    0 comments No comments

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.