infra_code

infrastructure-as-code
git clone git://git.pyratebeard.net/infra_code.git
Log | Files | Refs | README

commit 34a97597c4003545036368a38473bff2d99f39ac
parent 1e3cd97b5f5dc7f04f8e3d196e53e296dcb765c3
Author: pyratebeard <root@pyratebeard.net>
Date:   Thu,  9 May 2024 15:31:44 +0100

libvirt | debian12 | use runcmd to create user with specific uid and allow root login

Diffstat:
Mlibvirt/debian12/cloud_init.cfg | 17++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/libvirt/debian12/cloud_init.cfg b/libvirt/debian12/cloud_init.cfg @@ -5,10 +5,13 @@ preserve_hostname: false fqdn: ${hostname}.tilde.gdn hostname: ${hostname} -users: - - name: dwarf - ssh_authorized_keys: - - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICSluiY54h5FlGxnnXqifWPnfvKNIh1/f0xf0yCThdqV openpgp:0x65A514D0 - sudo: ['ALL=(ALL) NOPASSWD:ALL'] - shell: /bin/bash - groups: wheel +runcmd: + - useradd -omd /usr/dwarf -u 0 -g 0 -s /bin/bash dwarf + - mkdir /usr/dwarf/.ssh + - sed -i 's/.*\(PermitRootLogin.*\)/\1/' /etc/ssh/sshd_config + - systemctl reload sshd + +write_files: + - path: "/usr/dwarf/.ssh/authorized_keys" + append: true + content: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICSluiY54h5FlGxnnXqifWPnfvKNIh1/f0xf0yCThdqV