Max Cameron
Max Cameron

Reputation: 4837

What user does cloud-config run as?

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?

Upvotes: 16

Views: 8767

Answers (1)

Max Cameron
Max Cameron

Reputation: 4837

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.

Upvotes: 15

Related Questions