Once you start playing with cloud platforms and, in particular, with Virtual Machines, Containers, Volumes and so on, you have to learn different commands to make the access and usage of these resources more easy. In this page we report all tricks we learn from our experience in the cloud.

Cannot access to a VM by ssh


Cause: Your know_host file (usually located in ~/.ssh/know_hosts) has an invalid entry for the IP address of the machine you are trying to login. This is normal when a different VM has assigned a IP address previously used.

Solution: In the error message, you can find the line which is caused the problem and you just have to delete it. For example, if you get in the error message a line with "Offending ECDSA key in /home/mcanonic/.ssh/known_hosts:34", you have to remove the Line 34 from the know_hosts file.

Copy data between VMs

Error: Permission denied (publickey,gssapi-keyex,gssapi-with-mic)

Cause: You need to add your private key to your keychain to access the node from another.

Solution: You can use the same public key for both VMs. I would recommend forwarding your private key when logging into either of the VMs, this can be done more securely with the `-A` flag on ssh. Here is an example below:

local_machine:$ ssh-add /path/to/private_key

local_machine:$ ssh -A cc@<vm1_ip>

vm1:$ scp /path/to/file cc@<vm2_ip>:/path/to/folder