Tuesday, July 14, 2020

cloud-init change default user -AWS

If you are using custom AMI, you may want to use non-standard user instead of using default cloud-user. Replace cloud-user with any other user which you have probably already created for your AMI.

modify /etc/cloud/cloud.cfg

system_info:
  default_user:
    name: cloud-user
    lock_passwd: true
    gecos: Cloud User
    groups: [wheel, adm, systemd-journal]
    sudo: ["ALL=(ALL) NOPASSWD:ALL"]
    shell: /bin/bash
  distro: rhel
  paths:
    cloud_dir: /var/lib/cloud
    templates_dir: /etc/cloud/templates
  ssh_svcname: sshd
End it with folloowing command to rerun user related changes with new instance launch / reboot.
cloud-init clean

No comments:

Post a Comment