Cannot SSH into RancherOS v1.1.0 after install

I have currently tried to follow the guide here:
https://sdbrett.com/BrettsITBlog/2017/01/rancheros-installing-to-hard-disk/

Essentially:

  1. [VirtualBox] Create virtualbox VM (2048 Mb ram, 8 Gb VDI disk, bridged network mode, attach rancher.iso as cd-rom
  2. [VirtualBox] Start VM
  3. [vm console] sudo passwd rancher (enter password / confirm entry)
  4. Use PuttyGen to create RSA pub / ppk
  5. Use Putty to SSH into sever using rancher / new password.
  6. [ssh console] vi cloud-config.yml (paste text, save file)
  7. [ssh console] sudo ros install -c cloud-config.yml -d /dev/sda
  8. [ssh console] sudo poweroff
  9. [VirtualBox] Remove rancher.iso from cd-rom
  10. [VirtualBox] Start VM
  11. Then try and connect using the RSA key

Everything works until the last step… No matter what I do I always get “server refused our key”.

Searching seems to show I am not the first with this issue. I’ve read a couple different guides and seen a couple different examples of cloud-config.yml files and they do not appear to be consistent . (Different RancherOS versions maybe?)

I have tried (as separate cloud-config.yml file entries)
ssh_authorized_keys:
- ssh-rsa AAAAB… rest of my key … ==
- ssh-rsa AAAAB… rest of my key … == rancher@rancher
- ssh-rsa AAAAB… rest of my key … == RancherOS

Any help would be greatly appreciated. I am testing it out in a VM, before I attempt to install it in my home lab bare metal server.

Note: I am using Atom + js-yaml linter to verify my cloud-config.yml file locally before I copy/paste it into vi.
Example:
#cloud-config
hostname: rancher

ssh_authorized_keys:
  - ssh-rsa AAA ... the rsa key ... ==

rancher:
  docker:
    tls: true
  network:
    dns:
      nameservers:
      # google DNS
      - 8.8.8.8
      - 8.8.4.4
    interfaces:
      eth*:
        dhcp: true    # all interfaces use DHCP
1 Like

The text after the base64-encoded key is a comment to help you identify the key and is not used in any way. Typically it’s “user@host” where the key was generated.

You need #cloud-config at the beginning of the file. You mention it but you have no one complete valid example with a key in your post.

The entire key also needs to be one line in the file, you may be pasting multiple line breaks.

And you don’t show how you’re trying to connect, but the username needs to be “rancher”, i.e. ssh rancher@1.2.3.4 or ssh -l rancher 1.2.3.4.

Good to know about the data after the key not being critical. So that should not be the problem.

My cloud-config.yml was almost identical to the lines after “Example:”. It did start with #cloud-config, but I am not certain if it was the very first line or not. Would white space there cause a problem? (It is the top line in my desktop cloud-config.yml, but after pasting into VI maybe there was white space at the top.)

Been trying to connect via Putty, following the guide listed.
-> Session - IP address is correctly set
-> Data - “Auto-login user name” is rancher > Data
-> SSH -> Auth -> Private Key file - set to my rancher.ppk

It seems like I am really close, but something small is preventing it from working.

Update:
Thank you. This time while doing it, I was very careful to make sure the #cloud-config was entered properly. For whatever reason, while copy/paste into vi, it was not taking the first couple of characters so the file started like oud-config and not #cloud-config.

Now I was able to SSH into the box. =) I figured it had to be something really simple but completely missed.

You didn’t hit i to get into insert mode , so you’re pasting in random commands…

  • # does a (reverse) search for what’s under the cursor (but that’s nothing),
  • cl is “change the character to the right”, which deletes the character to the right (also nothing) and then leaves you in insert mode.
  • Then the rest of the text (oud-config...) is pasted as content in insert mode instead of being interpreted as commands.

That makes sense. I wonder if any of the consoles come with nano by default?