Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What user does cloud-config run as?

Tags:

cloud-init

When spinning up an AWS or other cloud vendor instance, and using cloud-init to configure the host, what user do bash scripts that get called run as?

like image 720
J0hnG4lt Avatar asked Jun 14 '17 18:06

J0hnG4lt


1 Answers

Building an instance with the following config:

#cloud-config
write_files:
  - path: /root/test.sh
    content: |
        #!/bin/bash
        set -x
        set -e
        whoami
runcmd:
  - bash /root/test.sh

I got an output of:

+ whoami
root

Ubuntu cloud-config runs as root.

like image 182
J0hnG4lt Avatar answered Jan 01 '23 18:01

J0hnG4lt