Accessing a Linux VM

You can access a Linux virtual machine (VM) by connecting to it through the SSH protocol.

On Linux and macOS computers, the OpenSSH client is usually installed by default. On Windows, you need to install it.

This procedure only applies to VMs based on official OMIs, using the default keypair authentication system. In other cases, the connection process can differ. For more information, see About Keypairs.

From a Linux or macOS Computer

Before you begin:

  1. To allow the connection from your source computer to the destination VM, add the following security group rule to the VM:

    • Port: 22 (SSH)

    • Protocol: TCP

    • CIDR: The IP of your source computer

    For more information, see Adding Rules to a Security Group.

  2. In a terminal, type the following command to restrict the read/write permissions of the keypair to only yourself:

    $ chmod 600 KEYPAIR

    where KEYPAIR is the path to the .rsa file containing the private key of the keypair on your computer.

To access the VM using OpenSSH, use the ssh command following this syntax:

$ ssh -i KEYPAIR outscale@VM_IP

This command contains the following attributes that you need to specify:

  • KEYPAIR: The path to the .rsa file containing the private key on your computer.

  • VM_IP: The public IP of the VM.

    If you are using a VPN or a DirectLink connection, you can specify the private IP of the VM.

From a Windows Computer

Before you begin:

  1. To allow the connection from your source computer to the destination VM, add the following security group rule to the VM:

    • Port: 22 (SSH)

    • Protocol: TCP

    • CIDR: The IP of your source computer

    For more information, see Adding Rules to a Security Group.

  2. In a terminal, type the following commands to restrict the read/write permissions of the keypair to only yourself:

    $ Set filepath=KEYPAIR
    $ icacls %filepath% /grant %username%:rw
    $ icacls %filepath% /inheritance:d
    $ icacls %filepath% /remove *S-1-5-11 *S-1-5-18 *S-1-5-32-544 *S-1-5-32-545

    where KEYPAIR is the path to the .rsa file containing the private key of the keypair on your computer.

  3. In the Windows Settings, search for Add an optional feature and install OpenSSH Client.

To access the VM using OpenSSH, use the ssh command following this syntax:

$ ssh -i KEYPAIR outscale@VM_IP

This command contains the following attributes that you need to specify:

  • KEYPAIR: The path to the .rsa file containing the private key on your computer.

  • VM_IP: The public IP of the VM.

    If you are using a VPN or a DirectLink connection, you can specify the private IP of the VM.

Related Pages