compute engine startup script can't execute as a non-root user
问题 Boiling my issue down to the simplest case, I'm using Compute Engine with the following startup-script: #! /bin/bash sudo useradd -m drupal su drupal cd /home/drupal touch test.txt I can confirm the drupal user exists after this command, so does the test file. However I expect the owner of the test file to be 'drupal' (hence the su). However, when I use this as a startup script I can still confirm ROOT is the owner of the file: meaning my su drupal did not work. sudo su drupal also does not