SSH key gets Injected to wrong user by cloud-init
I am trying to get ssh key
injected to my new user but instead it gets added to other user account on image.
My image is based on the Ubuntu cloud image and I have my added my user account to it.
When I launch new vm from that image my user account does not get the key added to its authorized keys
.
Instead key added to authorized keys
of user named ubuntu
.
In my cloud-ini
config I have:
default_user:
name: myuser
gecos: Ubuntu
shell: /bin/bash
In cloud-init
logs I see the key being written to wrong user: 2019-02-21 12:47:32,888 - util.py[DEBUG]: Writing to /home/ubuntu/.ssh/authorized_keys - wb: [600] 397 bytes
I tried deleting the ubuntu
user but it did not help.
How can I configure cloud-init
to inject the key to myuser
instead of ubuntu
.
Can you share more of your cloud.cfg? Do you attach any user-data file to the instance? I also recommend to delete all previous data from any cloud-init processes before uploading it as a new base image.