3

I've setup a clean new VPS running Ubuntu 20.04 LTS with Hetzner and would like to access it via ssh.

Here is what I've tried to do:

  1. I have added my public ssh key (passphrase-less) in Hetzner's online GUI. That looked something like this:
ssh-rsa blahblahblah= my.name@gmail.com
  1. But when I attempt to ssh-copy-id this key to the server, I run into issues. Since I haven't logged into the server to create users, I don't know what to put for the user in this command:
ssh-copy-id -i .ssh/id_rsa_pub [user]@serveraddress

I've tried adding the key to root user like so:

ssh-copy-id -i .ssh/id_rsa_pub [user]@serveraddress

But then I'm prompted for a password I don't know.


This leads me to the following questions I've had a hard time finding answers to:

1. How can I use ssh-copy-id to copy my public key to the server if I haven't setup a user yet?

2. What is the default root password on the server? How Would I find this out? I've tried ubuntu, root, the basics.

3. What does adding a public key via GUI on the server host's website normally do with regards to server users? Does it add the key to the known_hosts file?

4. What is the technical significance of the final comment line in my public ssh key, currently my.name@gmail.com?

Karoh
  • 155
  • 2
  • 7
  • hetzner's FAG should adress this point. don't you have an option to specify public key during host creation ? (like AWS do for instance) – Archemar Oct 24 '20 at 16:56
  • You need to find what is the username that was created on the VPS, not just try to guess. – Michael Hampton Oct 24 '20 at 20:17
  • @Archemar, this wasn't part of the setup. I only have the option of adding my ssh key after the fact, but it doesn't allow me to specify user or anything. – Karoh Oct 25 '20 at 01:12
  • @MichaelHampton, the thing is I have no idea where to find this out. I can't find anything in the docs or FAQ. – Karoh Oct 25 '20 at 01:13
  • One would imagine they would mention it here under the "Security - ssh" section: https://docs.hetzner.com/robot/dedicated-server/security/ssh/. But I'm not seeing anything helpful. – Karoh Oct 25 '20 at 01:25
  • It turns out that the root password credentials can be reset within the Hetzner Cloud server interface under the option titled "Rescue". – Karoh Oct 25 '20 at 02:37

1 Answers1

1
  1. How can I use ssh-copy-id to copy my public key to the server if I haven't setup a user yet?

You'd need the password for the user, and for SSH to accept passwords (not always the case). I wouldn't expect this to be the way forward in this sort of situation, where the VPS provider has a copy of your public key.

  1. What is the default root password on the server? How Would I find this out? I've tried ubuntu, root, the basics.

There's nothing guaranteed; it will be defined by the VPS provider, and should be in their documentation.

  1. What does adding a public key via GUI on the server host's website normally do with regards to server users? Does it add the key to the known_hosts file?

Close; it would add it to the .ssh/authorized_keys file in some users' home directory. As you've identified, knowing which user is opaque

  1. What is the technical significance of the final comment line in my public ssh key, currently my.name@gmail.com?

Nothing technical, it's just a label for human use.

Craig Miskell
  • 4,216
  • 1
  • 16
  • 16
  • Regarding 1., so what would you expect is the way forward. How does this typically work? You spin up a new server, which I did, but then they don't tell me how to access it, so I figured there was some standard protocol that I missed. Nowhere in the process did they have me specify users. Also, as far as I've been able to search them, their documentation doesn't specify this either. – Karoh Oct 25 '20 at 01:14
  • 1
    It turns out that the root password credentials can be reset within the Hetzner Cloud server interface under the option titled "Rescue". – Karoh Oct 25 '20 at 02:37