Ubuntu Cloud-Init SSH Problem

andwiseb

New Member
Sep 16, 2023
10
1
3
Hello.

I have installed Ubuntu with Cloud-Init and I can log in via console without any problem, but when I try to log in with iTerm I get error. I leave the error and Cloud-Init settings as attachment below.
 

Attachments

  • 1696279614715.png
    1696279614715.png
    110.6 KB · Views: 82
  • 1696279704313.png
    1696279704313.png
    45 KB · Views: 70
Last edited:
The screenshot of a login failure is cut right after an ssh public key authentication is denied. Your cloud-init config shows that no public key was provided for this user, so its not surprising that this type of authentication failed.
You cut off anything that follows it, ie I would expect a password prompt which should work under normal circumstances.


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
The screenshot of a login failure is cut right after an ssh public key authentication is denied. Your cloud-init config shows that no public key was provided for this user, so its not surprising that this type of authentication failed.
You cut off anything that follows it, ie I would expect a password prompt which should work under normal circumstances.


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
How do I create a public key?
 
There are many guides on the net:
https://askubuntu.com/questions/46930/how-can-i-set-up-password-less-ssh-login
https://www.linuxbabe.com/linux-server/setup-passwordless-ssh-login

A related google search phrase: "ubuntu ssh key login without password"


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
I looked at it but I didn't fully understand. What I want is exactly this: After creating Ubuntu over the Cloud-Init, I want to give my client the root information of the server.
 
I want to give my client the root information of the server.
Most if not all official Cloud Images disallow root login via ssh by default. There are good security reasons to do so. I recommend that you simply follow the commands in one of the guides to a) generate SSH key b) copy ssh key to existing instance c) confirming that you can login with ssh key.
Then you can specify this key during your VM creation. Once you figure out the flow, use "sudo" to gain root privileges.

good luck


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
The procedure could be made much simpler by:
a) Creating an SSH key pair if one does not exist yet https://unix.stackexchange.com/questions/69314/automated-ssh-keygen-without-passphrase-how
ssh-keygen -b 2048 -t rsa -f /tmp/sshkey -q -N ""
b) adding ssh key to cloud-init:
qm set $VMID -sshkeys /tmp/sshkey.pub
c) log in to VM using SSH key to the new VM, using either default user (debian) or custom if "-ciuser" was used:
ssh -o "IdentitiesOnly=yes" -i /tmp/sshkey debian@<hostname>

This approach:
a) avoids creating insecure templates/instances
b) does not require libguestfs package installation
c) allows one to grab official cloud images without having to modify them manually
d) uses the images the way they were intended

Of course, you are free to do it any way you want.


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!