SSH gives you a shell on your TIR Virtual Machine (VM) as root, from a terminal on your computer.
It is the one way to work inside a VM.
Before you begin
Section titled “Before you begin”- A VM in the Running state.
- The private key that matches an SSH key attached to the VM. To attach another key, see Manage SSH keys on a VM.
- A security group on the VM that allows port 22, where SSH listens, from your address. See Attach security groups to a VM.
Find the SSH command
Section titled “Find the SSH command”Open the VM from Manage VMs by selecting its name. While the VM is Running, SSH Command is under Connection Details on the Overview tab. The SSH button at the top of the VM’s page gives the same command, a version with a key file, and a few commands to try once you are in.
Connect from a terminal
Section titled “Connect from a terminal”-
Copy SSH Command. It has this form, with the VM’s address in place of
<ip-address>:ssh root@<ip-address>The address is the first one the VM has in this order: its public IP, its first reserved IP, its first VPC IP.
-
Paste the command into a terminal and run it. If your private key is in a file other than the one SSH tries by default, name it with
-i:ssh -i ~/.ssh/<private-key-file> root@<ip-address>Replace
<private-key-file>with the name of the private key that matches a key attached to the VM. -
The first time you connect to an address, SSH asks you to accept the VM’s fingerprint. Type
yes.
You now have a prompt on the VM, and every command you type runs there as root. On a GPU plan, run
nvidia-smi to see the VM’s GPUs.
Running means the VM’s operating system is up. If the connection is refused right after that, give SSH a moment to start and run the command again.
If the connection fails
Section titled “If the connection fails”| What you see | What to do |
|---|---|
Connection refused or Connection timed out |
Check that an attached security group allows TCP port 22 from your address. See Connection timed out. |
Permission denied (publickey) |
Sign in as root, with the private key of a key attached to the VM. See Permission denied. |
WARNING: UNPROTECTED PRIVATE KEY FILE! |
Run chmod 400 ~/.ssh/<private-key-file>, then connect again. |
Host key verification failed |
A different VM now answers at an address you used before. Run ssh-keygen -R <ip-address>, then connect again. |
| SSH Access shows Disabled | It turns on once the VM has an SSH key. Attach one. See Manage SSH keys on a VM. |
For other messages, see Troubleshooting TIR Virtual Machines.
With a shell open, add startup scripts to the VM so it sets itself up again on every boot. To keep the same address across a stop and a start, attach a reserved IP to the VM.