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: 93
  • 1696279704313.png
    1696279704313.png
    45 KB · Views: 81
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
 
After adding pubkey via dashboard in cloud init, how do I add pubkey without restarting the server ?
 
hi... thanks for the response, but i still can't access via ssh (pub key), if i am not restarting the server
I recommend that you open a separate thread, as your question does not appear to be connected with original OP's request.
In that new thread, provide more information, i.e. : VM config, steps you use to create it, things you can and cannot do, things you want to do, what happens when you try to do it, etc.



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!