Using Ubuntu Server 22.04, I am attempting to create an auto-installation setup for a physical client. I want to enable root login and execute late commands. Additionally, I want the hostname to be set as "new-client-macadress" without colons. Despite trying various syntaxes, the commands do not seem to take effect. I have experimented with different configurations, but none have yielded the desired results.
Here is my cloud-init conf
[QUOTE][
#cloud-config
autoinstall:
version: 1
user-data:
hostname: new-client
timezone: Europe/Stockholm
chpasswd:
expire: false
list:
- root:$6$exDY1mhS4KUYCE/2$zmn9ToZwTKLhCw.b4/b.ZRTIZM30JZ4QrOQ2aOXJ8yk96xpcCof0kxKwuX1kqLG/ygbJ1f8wxED22bTL4F46P0
keyboard:
layout: se
toggle: null
variant: ''
late-commands:
- sed -i "s?new-client?new-client-$(cat /target/sys/class/net/enp*/address | sed 's/\://g')?g" /target/etc/hostname /etc/hosts"
- echo "PermitRootLogin yes" | tee -a /target/etc/ssh/sshd_config"
- systemctl restart ssh
/QUOTE]
Very grateful for any feedback
Bookmarks