2

I am stuck with creating users with Cloud-Config.

Did anyone succeed and can share a .yaml gist to create a new user with ssh-authorized-keys and ability to sudo?

Erik Ušaj
  • 159
  • 6
  • More of us here;https://www.digitalocean.com/community/questions/cloud-config-on-cents-not-working-at-all – kjetildm Jul 29 '15 at 13:10

1 Answers1

3

This article on DigitalOcean runs through doing some of the most common initial tasks using cloud-config files.

Setting up a new sudo user would look like this:

#cloud-config
users:
  - name: username
    ssh-authorized-keys:
      - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCv60WjxoM39LgPDbiW7ne3gu18q0NIVv0RE6rDLNal1quXZ3nqAlANpl5qmhDQ+GS/sOtygSG4/9aiOA4vXO54k1mHWL2irjuB9XbXr00+44vSd2q/vtXdGXhdSMTf4/XK17fjKSG/9y3yD6nml6 user@example.com
    sudo: ['ALL=(ALL) NOPASSWD:ALL']
    groups: sudo
    shell: /bin/bash

Of course, replace the ssh key with your public key.

andrewsomething
  • 2,146
  • 2
  • 18
  • 22