SSH with password access
# access with username/password
# create a user on virtual machine
sudo useradd -m <username> -s /bin/bash
# add password on virtual machine
passwd <username>
# login virtual machine with username/password
ssh username@ip
# access with keys
# generate a public key and a private key under ~/.ssh on local
# algorithm, rsa, dsa, ecdsa, ed25519
ssh-keygen -f [filename] -t [algorithm]
# copy the public key to authorized_keys under ~/.ssh on virtual machine
# login virtual machine with private key from local
ssh -i <private key> username@ip
SSH with public key access
# change mode to read only
chmod 400 <private key>
# access with private key
ssh -i <private key path> username@ip
# create a user on virtual machine
sudo useradd -m <username> -s /bin/bash
# create authorized_keys under ~/.ssh on virtual machine
cd /home/<username>
sudo mkdir .ssh
cd .ssh
sudo touch authorized_keys
# generate a public key and a private key under ~/.ssh on local
# algorithm, rsa, dsa, ecdsa, ed25519
ssh-keygen -f [filename] -t [algorithm]
# copy the public key to authorized_keys under ~/.ssh on virtual machine
# login virtual machine with private key from local
ssh -i <private key> username@ip
Remote Desktop Protcol (RDP)
# Add Inbound port rules in Setting -> Networking
Priority: 300
Name: Port_3389
Port(Destination): 3389
Protocol: TCP
Source: Any
Destinations: Any
Action: Allow
# test RDP connection in Connect
# Enable rdp on VM
sudo apt-get -y install xrdp
sudo systemctl enable xrdp
# Download RDP file to launch Microsoft Remote Desktop
Bastion
# 1. Create a Bastion and create a Virtual Network
# 2. Create a Virtual Machine