Skip to main content

Access your VMs

SSH into a VM

SSH is the primary method of accessing VMs. When you create a VM, you will be given a public IP address (e.g. 91.106.222.0) as well as a private IP address (e.g. 172.27.0.10) to access the newly created VM, either over the public internet or within your VPC. You can access these IPs via the instance page in the console, or with crusoe compute vms get <vm_name>.

You should ssh in as the default user for your operating system. Also, make sure your local machine has the same SSH key you used when creating the VM.

By default, Public IPs are tied to the lifecycle of the VM, and will change if a VM is stopped and started. You can optionally enable a static public IP.

Private IPs are static, and will not change based on the lifecycle of the VM.

Firewall Rules

VPC networks contain default firewall rules that allow for SSH access to all VMs from the public internet, as well as other VMs on the subnet. If this is removed, SSH access will be removed.

If you are unable to ssh into a VM, ensure that your firewall rules allow ssh (destination: tcp:22) access.

Handling errors

Occasionally there will be an error with the SSH connection. If you see the Network unreachable or Connection refused errors, especially immediately after starting a VM, please wait a minute or two and try again. If you see other errors and are unable to log in to a running virtual machine, please contact support.

Setting longer SSH timeouts

If you want to set a longer timeout, you can modify your /etc/ssh/sshd_config, for example to keep a connection alive for 24 hours:

ClientAliveInterval 120
ClientAliveCountMax 720

Once you've saved the file, restart the ssh service by running service sshd restart. Note that if you're sshed in, you will get disconnected.

Add additional SSH keys to a VM

If you wish to allow other users access to your VM, you can add their SSH public key to the ~/.ssh/authorized_keys file on the VM you wish to grant them access to, replacing SSH_PUBLIC_KEY with the desired public key:

echo "SSH_PUBLIC_KEY" >> ~/.ssh/authorized_keys

The newly added user should now be able to SSH into the machine their key was added to using the steps outlined above.

Internal DNS

You can also reach VMs within the VPC using the internal DNS address: $VM_NAME.$LOCATION.compute.internal. Learn more at Internal DNS.

Serial Console access

In the event that you are unable to SSH into your VM (e.g. the SSH server is not running or your keys are not present on the VM), or there is a problem with your VM, you can use the serial console to access the VM's serial port.

Enabling and disabling serial console access

In order to enable serial console access, you will need to set an appropriate user and password by establishing an SSH connection and using passwd to set a password:

# Set a local password for the currently logged in user
sudo passwd $(whoami)

Using the serial console

The serial console is available via the CLI, using the compute vms serial-console command:

crusoe compute vms serial-console \
--name NAME \
--port-num PORT

This will open a connection to the serial console on the VM.

Exiting the serial console

You can exit the serial console by typing ~. on a newline.

Port number

Port number must be between 1 to 4 inclusive, with a maximum of one connection to a port at a time.

If no port is specified, the default is port 1, which shows boot messages and is most useful for debugging.

Serial console timeout

The serial console times out after 30 minutes, regardless of activity (or inactivity).